/
githubmirror
/
babel
Обзор
Документация
Войти
/
githubmirror
/
babel
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
benchmark/babel-parser/many-empty-statements/attachComment-false.bench.mjs
20 строк
631 B
Huáng Jùnliàng
Add `attachComment` parser option to disable comment attachment (#13229)
04 авг 2021, 18:04
Не верифицирован
04 авг 2021, 18:04
d5b0d9e
Код
Авторство
О чём код?
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 benchCases(name, implementation, options) { for (const length of [256, 512, 1024, 2048]) { const input = ";".repeat(length); suite.add(`${name} ${length} empty statement`, () => { implementation.parse(input, options); }); } } benchCases("baseline", baseline, { attachComment: true }); benchCases("current + attachComment: false", current, { attachComment: false }); suite.on("cycle", report).run();