| 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 = "stringLiteral"; |
| 10 |
for (const version in implementations) { |
| 11 |
const t = implementations[version]; |
| 12 |
const func = t[funcName]; |
| 13 |
suite.add(`${version} ${funcName} builder`, () => { |
| 14 |
func("bar"); |
| 15 |
}); |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
benchCases({ baseline, current }); |
| 20 |
|
| 21 |
suite.on("cycle", report).run(); |