| 1 |
import Benchmark from "benchmark"; |
| 2 |
import baseline from "@babel-baseline/types"; |
| 3 |
import current from "@babel/types"; |
| 4 |
import { report } from "../../util.mjs"; |
| 5 |
|
| 6 |
const suite = new Benchmark.Suite(); |
| 7 |
|
| 8 |
function benchCases(implementations) { |
| 9 |
const funcName = "memberExpression"; |
| 10 |
for (const version in implementations) { |
| 11 |
const t = implementations[version]; |
| 12 |
const func = t[funcName]; |
| 13 |
const idObj = t.identifier("obj"); |
| 14 |
const idProp = t.identifier("prop"); |
| 15 |
suite.add(`${version} ${funcName} builder`, () => { |
| 16 |
func(idObj, idProp, /*computed?*/ false /*, optional? missing*/); |
| 17 |
}); |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
benchCases({ baseline, current }); |
| 22 |
|
| 23 |
suite.on("cycle", report).run(); |