chore: reorganize benchmarks (#13606)
This commit is contained in:
23
benchmark/babel-parser/many-identifiers/1-length.bench.mjs
Normal file
23
benchmark/babel-parser/many-identifiers/1-length.bench.mjs
Normal file
@@ -0,0 +1,23 @@
|
||||
import Benchmark from "benchmark";
|
||||
import baseline from "@babel-baseline/parser";
|
||||
import current from "@babel/parser";
|
||||
import { report } from "../../util.mjs";
|
||||
|
||||
const suite = new Benchmark.Suite();
|
||||
function createInput(length) {
|
||||
return "a;".repeat(length);
|
||||
}
|
||||
current.parse("a");
|
||||
function benchCases(name, implementation, options) {
|
||||
for (const length of [64, 128, 256, 512, 1024]) {
|
||||
const input = createInput(length);
|
||||
suite.add(`${name} ${length} length-1 identifiers`, () => {
|
||||
implementation.parse(input, options);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
benchCases("baseline", baseline);
|
||||
benchCases("current", current);
|
||||
|
||||
suite.on("cycle", report).run();
|
||||
23
benchmark/babel-parser/many-identifiers/11-length.bench.mjs
Normal file
23
benchmark/babel-parser/many-identifiers/11-length.bench.mjs
Normal file
@@ -0,0 +1,23 @@
|
||||
import Benchmark from "benchmark";
|
||||
import baseline from "../../lib/index-main.js";
|
||||
import current from "@babel/parser";
|
||||
import { report } from "../../util.mjs";
|
||||
|
||||
const suite = new Benchmark.Suite();
|
||||
function createInput(length) {
|
||||
return "abcde12345z;".repeat(length);
|
||||
}
|
||||
current.parse("a");
|
||||
function benchCases(name, implementation, options) {
|
||||
for (const length of [64, 128, 256, 512]) {
|
||||
const input = createInput(length);
|
||||
suite.add(`${name} ${length} length-11 identifiers`, () => {
|
||||
implementation.parse(input, options);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
benchCases("baseline", baseline);
|
||||
benchCases("current", current);
|
||||
|
||||
suite.on("cycle", report).run();
|
||||
23
benchmark/babel-parser/many-identifiers/2-length.bench.mjs
Normal file
23
benchmark/babel-parser/many-identifiers/2-length.bench.mjs
Normal file
@@ -0,0 +1,23 @@
|
||||
import Benchmark from "benchmark";
|
||||
import baseline from "@babel-baseline/parser";
|
||||
import current from "@babel/parser";
|
||||
import { report } from "../../util.mjs";
|
||||
|
||||
const suite = new Benchmark.Suite();
|
||||
function createInput(length) {
|
||||
return "aa;".repeat(length);
|
||||
}
|
||||
current.parse("a");
|
||||
function benchCases(name, implementation, options) {
|
||||
for (const length of [64, 128, 256, 512, 1024]) {
|
||||
const input = createInput(length);
|
||||
suite.add(`${name} ${length} length-2 identifiers`, () => {
|
||||
implementation.parse(input, options);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
benchCases("baseline", baseline);
|
||||
benchCases("current", current);
|
||||
|
||||
suite.on("cycle", report).run();
|
||||
23
benchmark/babel-parser/many-identifiers/await.mjs
Normal file
23
benchmark/babel-parser/many-identifiers/await.mjs
Normal file
@@ -0,0 +1,23 @@
|
||||
import Benchmark from "benchmark";
|
||||
import baseline from "../../lib/index-main.js";
|
||||
import current from "@babel/parser";
|
||||
import { report } from "../../util.mjs";
|
||||
|
||||
const suite = new Benchmark.Suite();
|
||||
function createInput(length) {
|
||||
return "await;".repeat(length);
|
||||
}
|
||||
current.parse("a");
|
||||
function benchCases(name, implementation, options) {
|
||||
for (const length of [64, 128, 256, 512]) {
|
||||
const input = createInput(length);
|
||||
suite.add(`${name} ${length} await identifier`, () => {
|
||||
implementation.parse(input, options);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
benchCases("baseline", baseline);
|
||||
benchCases("current", current);
|
||||
|
||||
suite.on("cycle", report).run();
|
||||
Reference in New Issue
Block a user