node/benchmark
SeokhunEom 42d0e1307b
Some checks failed
Test and upload documentation to artifacts / build-docs (push) Has been cancelled
Linters / lint-addon-docs (push) Has been cancelled
Linters / lint-cpp (push) Has been cancelled
Linters / format-cpp (push) Has been cancelled
Linters / lint-js-and-md (push) Has been cancelled
Linters / lint-nix (push) Has been cancelled
Linters / lint-py (push) Has been cancelled
Linters / lint-yaml (push) Has been cancelled
Linters / lint-sh (push) Has been cancelled
Linters / lint-codeowners (push) Has been cancelled
Linters / lint-pr-url (push) Has been cancelled
Linters / lint-readme (push) Has been cancelled
Notify on Push / Notify on Force Push on `main` (push) Has been cancelled
Notify on Push / Notify on Push on `main` with invalid message (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
benchmark: use boolean options in benchmark tests
Use boolean values for randomUUID benchmark and
deprecate benchmark instead of 0/1.

PR-URL: https://github.com/nodejs/node/pull/60129
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2025-12-25 10:45:07 +00:00
..
abort_controller
assert assert,util: handle invalid dates as equal in deep comparison 2025-06-21 04:00:23 +00:00
async_hooks
blob
buffers benchmark: fix incorrect base64 input in byteLength benchmark 2025-12-03 07:19:16 +00:00
child_process
cluster benchmark: calibrate config cluster/echo.js 2025-09-12 12:59:37 +00:00
console console: optimize single-string logging 2025-11-02 23:33:58 +00:00
crypto benchmark: use boolean options in benchmark tests 2025-12-25 10:45:07 +00:00
dgram benchmark: update num to n in dgram offset-length 2025-09-24 20:33:09 +00:00
diagnostics_channel benchmark: reduce N for diagnostics_channel subscribe benchmark 2025-07-20 20:45:00 +00:00
dns
domain
error
es benchmark: remove deprecated _extend from benchmark 2025-08-11 15:42:46 +00:00
esm benchmark: use typescript for import cjs benchmark 2025-11-12 18:34:59 +00:00
events events: optimize EventTarget.addEventListener 2024-10-14 10:24:32 +00:00
fixtures benchmark: focus on import.meta intialization in import-meta benchmark 2025-11-08 16:33:34 +00:00
fs benchmark: reduce readfile-permission-enabled config 2025-08-24 21:19:33 +00:00
http benchmark, test: replace CRLF variable with string literal 2025-08-20 07:10:17 +00:00
http2
https
internal lib,src: isInsideNodeModules should test on the first non-internal frame 2025-12-10 13:59:35 +00:00
mime
misc benchmark: drop misc/punycode benchmark 2025-07-24 17:06:06 +00:00
module benchmark: add per-suite setup option 2025-11-07 17:47:43 +00:00
napi node-api: add napi_create_object_with_properties 2025-10-30 14:10:44 +00:00
net
os
path path: improve path.resolve() performance when used as process.cwd() 2025-05-19 13:23:57 +00:00
perf_hooks benchmark: add nodeTiming.uvmetricsinfo bench 2024-11-01 13:35:15 -03:00
permission benchmark: update count to n in permission startup 2025-09-24 20:33:10 +00:00
process
querystring
readline
source_map benchmark: add source map and source map cache 2025-07-07 15:53:35 +00:00
sqlite benchmark: sqlite prevent create both tables on prepare selects 2025-09-03 19:18:05 +00:00
streams stream: preserve AsyncLocalStorage on finished only when needed 2025-10-27 19:23:34 +00:00
string_decoder benchmark: adjust configuration for string-decoder bench 2025-07-25 20:49:56 +00:00
test_runner test_runner: run single test file benchmark 2025-01-09 11:12:12 +00:00
timers
tls tls: remove deprecated tls.createSecurePair 2025-03-11 23:01:28 +00:00
ts module: unflag --experimental-strip-types 2024-12-26 18:46:06 +00:00
url url: remove array.reduce usage 2025-11-23 17:13:58 +00:00
util benchmark: use boolean options in benchmark tests 2025-12-25 10:45:07 +00:00
v8 benchmark: calibrate config v8/serialize.js 2025-08-25 13:35:26 +00:00
validators
vm benchmark: add benchmark for leaf source text modules 2025-10-18 08:20:47 +00:00
websocket
webstorage src: unflag --experimental-webstorage by default 2025-09-25 11:59:58 +00:00
webstreams
worker
zlib zlib: implement fast path for crc32 2025-09-14 00:39:58 +00:00
_benchmark_progress.js
_cli.js benchmark: small lint fix on _cli.js 2025-07-24 17:17:52 +00:00
_cli.R
_http-benchmarkers.js lib: prefer logical assignment 2024-10-09 06:42:16 +00:00
_test-double-benchmarker.js
bar.R
calibrate-n.js benchmark: add calibrate-n script 2025-07-29 18:49:55 +00:00
common.js benchmark: allow boolean option values 2025-12-25 10:45:06 +00:00
compare.js
compare.R
cpu.sh benchmark: improve cpu.sh for safety and usability 2025-10-27 14:10:27 +00:00
eslint.config_partial.mjs tools: import rather than require ESLint plugins 2025-03-07 14:52:52 +00:00
README.md
run.js benchmark: add --track to benchmark 2025-07-25 13:22:26 +00:00
scatter.js
scatter.R

Node.js Core Benchmarks

This folder contains code and data used to measure performance of different Node.js implementations and different ways of writing JavaScript run by the built-in JavaScript engine.

For a detailed guide on how to write and run benchmarks in this directory, see the guide on benchmarks.

Table of Contents

File tree structure

Directories

Benchmarks testing the performance of a single node submodule are placed into a directory with the corresponding name, so that they can be executed by submodule or individually. Benchmarks that span multiple submodules may either be placed into the misc directory or into a directory named after the feature they benchmark. E.g. benchmarks for various new ECMAScript features and their pre-ES2015 counterparts are placed in a directory named es. Fixtures that are not specific to a certain benchmark but can be reused throughout the benchmark suite should be placed in the fixtures directory.

Other Top-level files

The top-level files include common dependencies of the benchmarks and the tools for launching benchmarks and visualizing their output. The actual benchmark scripts should be placed in their corresponding directories.

  • _benchmark_progress.js: implements the progress bar displayed when running compare.js
  • _cli.js: parses the command line arguments passed to compare.js, run.js and scatter.js
  • _cli.R: parses the command line arguments passed to compare.R
  • _http-benchmarkers.js: selects and runs external tools for benchmarking the http subsystem.
  • bar.R: R script for visualizing the output of benchmarks with bar plots.
  • common.js: see Common API.
  • compare.js: command line tool for comparing performance between different Node.js binaries.
  • compare.R: R script for statistically analyzing the output of compare.js
  • run.js: command line tool for running individual benchmark suite(s).
  • scatter.js: command line tool for comparing the performance between different parameters in benchmark configurations, for example to analyze the time complexity.
  • scatter.R: R script for visualizing the output of scatter.js with scatter plots.

Common API

The common.js module is used by benchmarks for consistency across repeated tasks. It has a number of helpful functions and properties to help with writing benchmarks.

createBenchmark(fn, configs[, options])

See the guide on writing benchmarks.

default_http_benchmarker

The default benchmarker used to run HTTP benchmarks. See the guide on writing HTTP benchmarks.

PORT

The default port used to run HTTP benchmarks. See the guide on writing HTTP benchmarks.

sendResult(data)

Used in special benchmarks that can't use createBenchmark and the object it returns to accomplish what they need. This function reports timing data to the parent process (usually created by running compare.js, run.js or scatter.js).