Skip to content

src: reserve shared_array_buffers capacity in Message::Deserialize - #65304

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
agape1225:src-messaging-reserve-shared-array-buffers
Sep 25, 2026
Merged

nodejs-github-bot merged 1 commit into
nodejs:mainfrom
agape1225:src-messaging-reserve-shared-array-buffers

Conversation

@agape1225

Copy link
Copy Markdown
Contributor

shared_array_buffers grows via repeated push_back() while iterating shared_array_buffers_, even though shared_array_buffers_.size() is already known before the loop starts and is an exact count of how many items will be pushed (one per iteration, unconditionally). This reserves capacity upfront to avoid the repeated allocate/copy/ free cycle that happens each time capacity is exceeded, mirroring the existing array_buffers.reserve() in the sibling Message::Serialize().

shared_array_buffers grows via repeated push_back() while iterating
shared_array_buffers_, even though shared_array_buffers_.size() is
already known before the loop starts and is an exact count of how
many items will be pushed (one per iteration, unconditionally).
This reserves capacity upfront to avoid the repeated allocate/copy/
free cycle that happens each time capacity is exceeded, mirroring
the existing array_buffers.reserve() in the sibling
Message::Serialize().

Signed-off-by: agape1225 <49804691+agape1225@users.noreply.github.com>
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Aug 15, 2026
@codecov

codecov Bot commented Aug 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.34%. Comparing base (2929417) to head (ad63add).
⚠️ Report is 820 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65304      +/-   ##
==========================================
- Coverage   90.34%   90.34%   -0.01%     
==========================================
  Files         751      751              
  Lines      250330   250331       +1     
  Branches    47321    47312       -9     
==========================================
- Hits       226171   226150      -21     
- Misses      15557    15568      +11     
- Partials     8602     8613      +11     
Files with missing lines Coverage Δ
src/node_messaging.cc 82.96% <100.00%> (+0.01%) ⬆️

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

@daeyeon daeyeon added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Sep 21, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Sep 21, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@panva panva added author ready PRs with CI started, the required approvals, and no outstanding review comments. resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. labels Sep 25, 2026
@github-actions github-actions Bot added resume-ci-failed Resuming CI with the resume-ci label failed and requires manual intervention. and removed resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. labels Sep 25, 2026
@github-actions

This comment was marked as outdated.

@panva panva removed the resume-ci-failed Resuming CI with the resume-ci label failed and requires manual intervention. label Sep 25, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@panva panva added the commit-queue PRs queued for automated landing through the Commit Queue. label Sep 25, 2026
@nodejs-github-bot
nodejs-github-bot merged commit e76358e into nodejs:main Sep 25, 2026
90 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in e76358e

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Sep 25, 2026
aduh95 pushed a commit that referenced this pull request Sep 27, 2026
shared_array_buffers grows via repeated push_back() while iterating
shared_array_buffers_, even though shared_array_buffers_.size() is
already known before the loop starts and is an exact count of how
many items will be pushed (one per iteration, unconditionally).
This reserves capacity upfront to avoid the repeated allocate/copy/
free cycle that happens each time capacity is exceeded, mirroring
the existing array_buffers.reserve() in the sibling
Message::Serialize().

Signed-off-by: agape1225 <49804691+agape1225@users.noreply.github.com>
PR-URL: #65304
Reviewed-By: James M Snell <jasnell@gmail.com>
HoonDongKang pushed a commit to HoonDongKang/node that referenced this pull request Sep 28, 2026
shared_array_buffers grows via repeated push_back() while iterating
shared_array_buffers_, even though shared_array_buffers_.size() is
already known before the loop starts and is an exact count of how
many items will be pushed (one per iteration, unconditionally).
This reserves capacity upfront to avoid the repeated allocate/copy/
free cycle that happens each time capacity is exceeded, mirroring
the existing array_buffers.reserve() in the sibling
Message::Serialize().

Signed-off-by: agape1225 <49804691+agape1225@users.noreply.github.com>
PR-URL: nodejs#65304
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 pushed a commit that referenced this pull request Sep 28, 2026
shared_array_buffers grows via repeated push_back() while iterating
shared_array_buffers_, even though shared_array_buffers_.size() is
already known before the loop starts and is an exact count of how
many items will be pushed (one per iteration, unconditionally).
This reserves capacity upfront to avoid the repeated allocate/copy/
free cycle that happens each time capacity is exceeded, mirroring
the existing array_buffers.reserve() in the sibling
Message::Serialize().

Signed-off-by: agape1225 <49804691+agape1225@users.noreply.github.com>
PR-URL: #65304
Reviewed-By: James M Snell <jasnell@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. c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants