benchmark 概念

https://en.wikipedia.org/wiki/Benchmark_(computing)

npm-benchmark

https://www.npmjs.com/package/benchmark

文档说明

https://benchmarkjs.com/docs

框架推荐

https://github.com/caderek/benny

很简单的 benchmark 的框架

1
2
3
4
5
6
7
8
9
10
11
Benny builds on top of the excellent (but complex) benchmark package.

Benny provides an improved API that allows you to:

easily prepare benchmarks for synchronous, as well as async code,
prepare local setup (sync or async) for each case,
skip or run only selected cases,
save results to a JSON / CSV / HTML (table or chart) file,
pretty-print results without additional setup,
use suite results as Promises.
Additionally, it provides sound defaults suitable for most use cases (that you can tweak if you need) and excellent IDE support with built-in type definitions.