/
githubmirror
/
babel
Обзор
Документация
Войти
/
githubmirror
/
babel
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
benchmark/babel-parser/many-template-elements/bench.mjs
23 строки
667 B
Huáng Jùnliàng
Improve template tokenizing (#13919)
07 дек 2021, 00:43
Не верифицирован
07 дек 2021, 00:43
94af0e5
Код
Авторство
О чём код?
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 "`" + " ${0}".repeat(length) + "`"; } function benchCases(name, implementation, options) { for (const length of [128, 256, 512, 1024]) { const input = createInput(length); suite.add(`${name} ${length} template elements`, () => { implementation.parse(input, options); }); } } current.parse(createInput(1)); benchCases("baseline", baseline); benchCases("current", current); suite.on("cycle", report).run();