@0x2e757/benchmark 中文文档教程
Benchmark
使用 Node.js 进行代码性能测试的库
Installation
npm i @0x2e757/benchmark
Usage example
如果在 JavaScript 中使用 import as:
const benchmark = require("@0x2e757/benchmark");
如果在 TypeScript 中使用 import as:
import * as benchmark from "@0x2e757/benchmark";
对代码进行基准测试:
benchmark.test({
"case 1": () => {
// Some code
},
"case 2": () => {
// Another code
},
});
Benchmark
Library for code performance testing using Node.js
Installation
npm i @0x2e757/benchmark
Usage example
If used in JavaScript import as:
const benchmark = require("@0x2e757/benchmark");
If used in TypeScript import as:
import * as benchmark from "@0x2e757/benchmark";
Benchmark your code:
benchmark.test({
"case 1": () => {
// Some code
},
"case 2": () => {
// Another code
},
});