/
githubmirror
/
babel
Обзор
Документация
Войти
/
githubmirror
/
babel
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
benchmark/babel-parser/many-nested-template-elements/bench.mjs
22 строки
658 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 "` ${".repeat(length) + "0" + "}`".repeat(length); } function benchCases(name, implementation, options) { for (const length of [128, 256, 512, 1024]) { const input = createInput(length); suite.add(`${name} ${length} nested template elements`, () => { implementation.parse(input, options); }); } } benchCases("baseline", baseline); benchCases("current", current); suite.on("cycle", report).run();