/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
examples/custom-javascript-parser/internals/bench.mjs
43 строки
878 B
Alexander Akait
refactor: derive ASI positions from source instead of acorn callback (#21453)
19 июл 2026, 23:58
Не верифицирован
19 июл 2026, 23:58
e4a217e
Код
Авторство
О чём код?
import fs from "node:fs"; import path from "node:path"; import { Bench } from "tinybench"; import oxcParse from "./oxc-parse.js"; import meriyahParse from "./meriyah-parse.js"; import acornParse from "./acorn-parse.js"; const options = { sourceType: "module", ecmaVersion: "latest", ranges: true, locations: true, comments: true, allowHashBang: true, allowReturnOutsideFunction: false }; const bench = new Bench({ name: "simple benchmark", time: 100 }); const sourceCode = fs.readFileSync( path.resolve( import.meta.dirname, "../../../node_modules/three/build/three.module.js" ), "utf8" ); bench .add("oxc", () => { oxcParse(sourceCode, options); }) .add("meriyah", () => { meriyahParse(sourceCode, options); }) .add("acorn", () => { acornParse(sourceCode, options); }); await bench.run(); console.log(bench.name); console.table(bench.table());