基准测试运行器
🌐 Benchmark runner
稳定性: 1.0 - 早期开发
源代码: lib/bench.js
node:bench 模块支持在当前进程中定义和运行 JavaScript 基准测试,并在新的子进程中运行一个基准测试文件。该模块仅在使用 --experimental-bench 标志启动 Node.js 时可用,并且只能通过 node: 方案导入:
🌐 The node:bench module supports defining and running JavaScript benchmarks in
the current process, and running one benchmark file in a fresh child process.
The module is only available when Node.js is started with the
--experimental-bench flag and can only be imported with the node: scheme:
import { bench, suite } from 'node:bench';const { bench, suite } = require('node:bench');