Install the dependency: pnpm install -D node-module-benchmarker
and use the node-module-benchmarker
executable instead of node
specifying the output path with the environment variable BENCHMARK_OUTPUT_PATH
.
For example, BENCHMARK_OUTPUT_PATH=benchmark.json pnpm exec node-module-benchmarker src/index.js
instead of node src/index.js
.
The tool will benchmark the time it takes to load the CJS and ESM modules, stop the execution after 5 seconds, and output the results.
- Clone the repository:
git clone https://github.com/catalysisdev/node-module-benchmarker.git
. - Install dependencies:
pnpm install
. - Build:
pnpm build
- Test:
pnpm test
.