Files
Huáng JùnliàngandGitHub 5c7a7e4fd7 Left-value parsing cleanup (#17160)
* cleanup

* refactor: simplify checkProto implementation

* rename test

* refactor: avoid second scan in type cast transform

* refactor: simplify ts parseConditional

The current logic is taken from the flow plugin

* add benchmark cases
2025-03-03 22:23:45 +01:00

21 lines
637 B
JavaScript

import Benchmark from "benchmark";
import { baselineParser, currentParser, report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "(" + "x ?".repeat(length) + "0" + ": x".repeat(length) + ");";
}
function benchCases(name, implementation, options) {
for (const length of [256, 512, 1024, 2048]) {
const input = createInput(length);
suite.add(`${name} ${length} nested conditional expressions`, () => {
implementation.parse(input, options);
});
}
}
benchCases("baseline", baselineParser);
benchCases("current", currentParser);
suite.on("cycle", report).run();