Skip to content

benchmark: add large buffer sizes to buffer-creation#61979

Open
RajeshKumar11 wants to merge 1 commit intonodejs:mainfrom
RajeshKumar11:perf/61967-large-buffer-alloc-bench
Open

benchmark: add large buffer sizes to buffer-creation#61979
RajeshKumar11 wants to merge 1 commit intonodejs:mainfrom
RajeshKumar11:perf/61967-large-buffer-alloc-bench

Conversation

@RajeshKumar11
Copy link
Contributor

Summary

  • Adds 10 KiB, 51 KiB, 102 KiB, and 204 KiB to the len parameter of benchmark/buffers/buffer-creation.js
  • The existing benchmark only covered sizes up to 8192 bytes (8 KiB); performance regressions in the medium-to-large size range were invisible

Root cause context

Issue #61967 reports significant Buffer.allocUnsafe() regressions in v24 vs v20:

Size v20.12.1 v24.13.0 Change
10 KiB 1044 ms 996 ms -5%
51 KiB 1230 ms 1387 ms +13%
102 KiB 1339 ms 2077 ms +55%
204 KiB 1969 ms 3349 ms +70%

The regression is limited to Buffer.allocUnsafe() sizes that bypass the small-allocation pool (≥ 4096 bytes), and shows size-dependent scaling. Adding these sizes to the benchmark makes the regression reproducible and trackable via CI benchmark comparisons.

To run with a smaller iteration count suitable for large sizes:

node benchmark/buffers/buffer-creation.js type=fast-allocUnsafe len=204800 n=10000

Test plan

  • node benchmark/buffers/buffer-creation.js continues to work for all existing sizes
  • New sizes 10240, 52224, 104448, 208896 can be selected via len= argument

Refs: #61967

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/performance

@nodejs-github-bot nodejs-github-bot added fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. labels Feb 25, 2026
@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.76%. Comparing base (da5efc4) to head (94c1142).
⚠️ Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #61979      +/-   ##
==========================================
+ Coverage   88.84%   89.76%   +0.92%     
==========================================
  Files         674      674              
  Lines      204957   205674     +717     
  Branches    39309    39437     +128     
==========================================
+ Hits       182087   184630    +2543     
+ Misses      15088    13271    -1817     
+ Partials     7782     7773       -9     
Files with missing lines Coverage Δ
lib/fs.js 98.19% <100.00%> (+4.85%) ⬆️
lib/internal/fs/promises.js 98.73% <100.00%> (+0.67%) ⬆️

... and 187 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.

The existing benchmark only covered sizes up to 8192 bytes. Sizes in
the 10 KiB–204 KiB range show significant performance regression in
Node.js v24 compared to v20 (see nodejs#61967). Add those sizes to make
the regression reproducible and trackable via CI benchmarks.

For large-size runs, override the default n via the CLI:
  node benchmark/buffers/buffer-creation.js \
    type=fast-allocUnsafe len=204800 n=10000

Refs: nodejs#61967
@RajeshKumar11 RajeshKumar11 force-pushed the perf/61967-large-buffer-alloc-bench branch from 94c1142 to 557164c Compare February 25, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants