Huáng Jùnliàng a387973821
Refactor private name tokenizing (#13256)
* add benchmark

* refactor: create tt.privateName token for private names

* add backward compat privateName = hash + name to Babel 7

* perf: get private name SV from token value

* chore: tweak benchmark file

* chore: update test fixtures

* convert tt.privateName to PrivateIdentifier

* perf: avoid most isPrivateName call

* Update packages/babel-parser/src/parser/expression.js

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>

* perf: use inlinable codePointAtPos

* make prettier happy

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
2021-05-06 09:46:09 -04:00

14 lines
429 B
JavaScript

export function report(event) {
const bench = event.target;
const factor = bench.hz < 100 ? 100 : 1;
const timeMs = bench.stats.mean * 1000;
const time =
timeMs < 10
? `${Math.round(timeMs * 1000) / 1000}ms`
: `${Math.round(timeMs)}ms`;
const msg = `${bench.name}: ${
Math.round(bench.hz * factor) / factor
} ops/sec ±${Math.round(bench.stats.rme * 100) / 100}% (${time})`;
console.log(msg);
}