Performance degradation of Buffer allocation in NodeJS v24
Open
Nobody has claimed this yet.
buffer
performance
- Dominant language
- JavaScript
- Stars
- 122k
- Forks
- 37.3k
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 283
Description
Version
v24.13.0
Platform
Linux ubuntu24 6.14.0-37-generic #37~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 20 10:25:38 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
console.log(process.version);
let table = [], count = 1e6;
for (let chunk_size of [10, 20, 50, 100, 200].map(v=>v*1024))
{
let ts = Date.now();
for (let i = 0; i<count; i++)
Buffer.allocUnsafe(chunk_size);
let te = Date.now();
table.push({chunk_size, ms: te-ts});
}
console.table(table, ['chunk_size', 'ms']);
How often does it reproduce? Is there a required condition?
Every time
What is the expected behavior? Why is that the expected behavior?
Buffer allocation in NodeJS v24 should be same or better than in v20.
What do you see instead?
Degradation depended on chunk size:
v20.12.1
┌─────────┬────────────┬──────┐
│ (index) │ chunk_size │ ms │
├─────────┼────────────┼──────┤
│ 0 │ 10240 │ 1044 │
│ 1 │ 20480 │ 1110 │
│ 2 │ 51200 │ 1230 │
│ 3 │ 102400 │ 1339 │
│ 4 │ 204800 │ 1969 │
└─────────┴────────────┴──────┘
v24.13.0
┌─────────┬────────────┬──────┐
│ (index) │ chunk_size │ ms │
├─────────┼────────────┼──────┤
│ 0 │ 10240 │ 996 │
│ 1 │ 20480 │ 1223 │
│ 2 │ 51200 │ 1387 │
│ 3 │ 102400 │ 2077 │
│ 4 │ 204800 │ 3349 │
└─────────┴────────────┴──────┘
Additional information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied Buffer.allocUnsafe benchmark on Node.js v20.12.1 and v24.13.0 under the stated Linux environment, then inspect the Buffer allocation path for changes affecting larger chunks. Done means the regression is explained and a reproducible benchmark or test demonstrates the relevant behavior and any correction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100