Skip to content

lib: apply multiple updates to node:bench - #66664

Closed
jasnell wants to merge 4 commits into
nodejs:mainfrom
jasnell:jasnell/node-bench-environment
Closed

jasnell wants to merge 4 commits into
nodejs:mainfrom
jasnell:jasnell/node-bench-environment

Conversation

@jasnell

@jasnell jasnell commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

Apply multiple improvements for node:bench

  • Built in reports include sys info
  • Default operation to 1 (so you can do b.end() in the simple case instead of b.end(1)
  • Post warmup GC
  • Dead code elimination prevention

@jasnell
jasnell requested review from aduh95 and mcollina October 11, 2026 18:03
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/config

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels Oct 11, 2026
@codecov

codecov Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.96413% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.69%. Comparing base (f4e89e7) to head (76ad4ad).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/bench_runner/reporter/spec.js 91.37% 5 Missing ⚠️
lib/internal/bench_runner/harness.js 92.85% 3 Missing ⚠️
lib/internal/bench_runner/environment.js 98.36% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66664      +/-   ##
==========================================
- Coverage   90.70%   90.69%   -0.02%     
==========================================
  Files         801      802       +1     
  Lines      281881   282101     +220     
  Branches    54315    54349      +34     
==========================================
+ Hits       255675   255845     +170     
- Misses      16353    16377      +24     
- Partials     9853     9879      +26     
Files with missing lines Coverage Δ
lib/bench.js 100.00% <100.00%> (ø)
lib/internal/bench_runner/benchmark.js 99.66% <100.00%> (+0.01%) ⬆️
lib/internal/bench_runner/cli.js 94.21% <100.00%> (+0.05%) ⬆️
lib/internal/bench_runner/reporter/json.js 100.00% <100.00%> (ø)
src/node_options.cc 88.25% <100.00%> (-0.03%) ⬇️
src/node_options.h 95.83% <ø> (ø)
lib/internal/bench_runner/environment.js 98.36% <98.36%> (ø)
lib/internal/bench_runner/harness.js 98.73% <92.85%> (-0.22%) ⬇️
lib/internal/bench_runner/reporter/spec.js 97.57% <91.37%> (-2.43%) ⬇️

... and 30 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-by: Opencode
b.end(N) ... N defaults to 1
b.report(...) operations defaults to 1

Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-by: Opencode
Adds option post-warmup and pre-sample gc options
to node:bench

Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-by: Opencode
Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-by: Opencode
@jasnell
jasnell force-pushed the jasnell/node-bench-environment branch from 6027448 to 76ad4ad Compare November 12, 2026 19:59
@nodejs-github-bot

nodejs-github-bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jasnell jasnell added author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue PRs queued for automated landing through the Commit Queue. labels Nov 12, 2026
@nodejs-github-bot nodejs-github-bot added commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. and removed commit-queue PRs queued for automated landing through the Commit Queue. labels Nov 12, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Commit Queue failed

This pull request has multiple commits, but no landing policy was selected.

Add commit-queue-squash PRs the Commit Queue should land as one squashed commit. to land it as one commit, or commit-queue-rebase PRs the Commit Queue should land as multiple self-contained commits. to land the commits separately.

The pull request was removed from the Commit Queue and labeled commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. . After resolving the failure, remove that label and add commit-queue PRs queued for automated landing through the Commit Queue. to retry.

Full Commit Queue output
�[36m⠋�[39m Loading data for nodejs/node/pull/66664
�[36m⠋�[39m Loading data for nodejs/node/pull/66664
�[36m⠋�[39m Getting collaborator contacts from README of nodejs/node
�[36m⠋�[39m Getting PR from nodejs/node/pull/66664
�[36m⠋�[39m Getting reviews from nodejs/node/pull/66664
�[36m⠋�[39m Getting comments from nodejs/node/pull/66664
�[36m⠋�[39m Getting commits from nodejs/node/pull/66664
✔  Done loading data for nodejs/node/pull/66664
----------------------------------- PR info ------------------------------------
Title      lib: apply multiple updates to node:bench (#66664)
Author     James M Snell <jasnell@gmail.com> (@jasnell)
Branch     jasnell:jasnell/node-bench-environment -> nodejs:main
Labels     lib / src, author ready, needs-ci, commit-queue
Commits    4
 - lib: update node:bench reporters to include sys info
 - lib: default bench operations to 1
 - lib: add gc options to node:bench
 - lib: avoid dead code elimination with node:bench
Committers 1
 - James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66664
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/66664
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Sun, 11 Oct 2026 18:03:50 GMT
   ✔  Approvals: 1
   ✔  - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/66664#pullrequestreview-5881609294
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2026-11-12T20:00:46Z: https://ci.nodejs.org/job/node-test-pull-request/79009/
�[36m⠙�[39m Querying data for job/node-test-pull-request/79009/
�[36m⠙�[39m Querying data for job/node-test-pull-request/79009/
�[36m⠙�[39m Querying API for job/node-test-pull-request/79009/
✔  Build data downloaded
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
�[36m⠹�[39m Bringing origin/main up to date...
�[36m⠹�[39m Bringing origin/main up to date...
From https://github.com/nodejs/node
 * branch                  main       -> FETCH_HEAD
✔  origin/main is now up-to-date
�[36m⠸�[39m Downloading patch for 66664
�[36m⠸�[39m Downloading patch for 66664
From https://github.com/nodejs/node
 * branch                  refs/pull/66664/merge -> FETCH_HEAD
✔  Fetched commits as f4e89e70dd36..76ad4ad15355
--------------------------------------------------------------------------------
[main d76dd5a960] lib: update node:bench reporters to include sys info
 Author: James M Snell <jasnell@gmail.com>
 Date: Sun Oct 11 16:54:28 2026 +0000
 6 files changed, 202 insertions(+), 17 deletions(-)
 create mode 100644 lib/internal/bench_runner/environment.js
[main a3fed32299] lib: default bench operations to 1
 Author: James M Snell <jasnell@gmail.com>
 Date: Sun Oct 11 17:07:02 2026 +0000
 3 files changed, 97 insertions(+), 6 deletions(-)
 create mode 100644 test/parallel/test-bench-end-operations.js
[main 196af4aa6c] lib: add gc options to node:bench
 Author: James M Snell <jasnell@gmail.com>
 Date: Sun Oct 11 17:38:31 2026 +0000
 11 files changed, 290 insertions(+), 5 deletions(-)
 create mode 100644 test/fixtures/bench-runner/gc.cjs
 create mode 100644 test/parallel/test-bench-gc.js
[main def4103030] lib: avoid dead code elimination with node:bench
 Author: James M Snell <jasnell@gmail.com>
 Date: Sun Oct 11 17:59:17 2026 +0000
 6 files changed, 162 insertions(+), 5 deletions(-)
 create mode 100644 test/parallel/test-bench-do-not-optimize.js
   ✔  Patches applied
There are 4 commits in the PR. Attempting autorebase.
(node:430) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated.
(Use `node --trace-deprecation ...` to show where the warning was created)
Rebasing (2/8)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
lib: update node:bench reporters to include sys info

Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-by: Opencode
PR-URL: https://github.com/nodejs/node/pull/66664
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
--------------------------------------------------------------------------------
[detached HEAD 21c89b36c3] lib: update node:bench reporters to include sys info
 Author: James M Snell <jasnell@gmail.com>
 Date: Sun Oct 11 16:54:28 2026 +0000
 6 files changed, 202 insertions(+), 17 deletions(-)
 create mode 100644 lib/internal/bench_runner/environment.js
Rebasing (3/8)
Rebasing (4/8)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
lib: default bench operations to 1

b.end(N) ... N defaults to 1
b.report(...) operations defaults to 1

Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-by: Opencode
PR-URL: https://github.com/nodejs/node/pull/66664
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
--------------------------------------------------------------------------------
[detached HEAD abb0526932] lib: default bench operations to 1
 Author: James M Snell <jasnell@gmail.com>
 Date: Sun Oct 11 17:07:02 2026 +0000
 3 files changed, 97 insertions(+), 6 deletions(-)
 create mode 100644 test/parallel/test-bench-end-operations.js
Rebasing (5/8)
Rebasing (6/8)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
lib: add gc options to node:bench

Adds option post-warmup and pre-sample gc options
to node:bench

Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-by: Opencode
PR-URL: https://github.com/nodejs/node/pull/66664
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
--------------------------------------------------------------------------------
[detached HEAD 8247fb6003] lib: add gc options to node:bench
 Author: James M Snell <jasnell@gmail.com>
 Date: Sun Oct 11 17:38:31 2026 +0000
 11 files changed, 290 insertions(+), 5 deletions(-)
 create mode 100644 test/fixtures/bench-runner/gc.cjs
 create mode 100644 test/parallel/test-bench-gc.js
Rebasing (7/8)
Rebasing (8/8)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
lib: avoid dead code elimination with node:bench

Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-by: Opencode
PR-URL: https://github.com/nodejs/node/pull/66664
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
--------------------------------------------------------------------------------
[detached HEAD b649221b92] lib: avoid dead code elimination with node:bench
 Author: James M Snell <jasnell@gmail.com>
 Date: Sun Oct 11 17:59:17 2026 +0000
 6 files changed, 162 insertions(+), 5 deletions(-)
 create mode 100644 test/parallel/test-bench-do-not-optimize.js
Successfully rebased and updated refs/heads/main.
--------------------------------------------------------------------------------
   ℹ  Add `commit-queue-squash` label to land the PR as one commit, or `commit-queue-rebase` to land as separate commits.

View workflow run

@jasnell jasnell added commit-queue PRs queued for automated landing through the Commit Queue. commit-queue-rebase PRs the Commit Queue should land as multiple self-contained commits. and removed commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. labels Nov 13, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 7b4c9e3...c905bed

nodejs-github-bot pushed a commit that referenced this pull request Nov 13, 2026
Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-by: Opencode
PR-URL: #66664
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
nodejs-github-bot pushed a commit that referenced this pull request Nov 13, 2026
b.end(N) ... N defaults to 1
b.report(...) operations defaults to 1

Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-by: Opencode
PR-URL: #66664
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
nodejs-github-bot pushed a commit that referenced this pull request Nov 13, 2026
Adds option post-warmup and pre-sample gc options
to node:bench

Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-by: Opencode
PR-URL: #66664
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
nodejs-github-bot pushed a commit that referenced this pull request Nov 13, 2026
Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-by: Opencode
PR-URL: #66664
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 13, 2026
aduh95 pushed a commit that referenced this pull request Nov 19, 2026
Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-by: Opencode
PR-URL: #66664
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
aduh95 pushed a commit that referenced this pull request Nov 19, 2026
b.end(N) ... N defaults to 1
b.report(...) operations defaults to 1

Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-by: Opencode
PR-URL: #66664
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
aduh95 pushed a commit that referenced this pull request Nov 19, 2026
Adds option post-warmup and pre-sample gc options
to node:bench

Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-by: Opencode
PR-URL: #66664
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
aduh95 pushed a commit that referenced this pull request Nov 19, 2026
Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-by: Opencode
PR-URL: #66664
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue-rebase PRs the Commit Queue should land as multiple self-contained commits. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants