Skip to content

src: avoid copying SEA snapshot data - #65876

Open
colinhacks wants to merge 1 commit into
nodejs:mainfrom
colinhacks:src-sea-borrow-snapshot-data
Open

src: avoid copying SEA snapshot data#65876
colinhacks wants to merge 1 commit into
nodejs:mainfrom
colinhacks:src-sea-borrow-snapshot-data

Conversation

@colinhacks

@colinhacks colinhacks commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Description

SEA snapshots live in a resource mapped from the executable. Node.js currently copies the V8 startup data out of that resource when it loads the snapshot.

This change lets V8 read the data in place. Snapshots loaded from a file or through the embedder API still use a copy because those buffers may not live long enough.

Benchmark

Median of 240 launches in randomized order, after 30 warmups. Linux x64 on an Intel Xeon Platinum 8481C. Both executables were built from 6f41e415639b5ec3dd816e44945cc73b4d7651e3.

SEA snapshot Before After Change
Empty 28.335 ms 26.610 ms -1.725 ms (-6.1%)
Computation 28.131 ms 26.491 ms -1.640 ms (-5.8%)
100,000 objects 56.285 ms 51.541 ms -4.745 ms (-8.4%)

Validation

  • make lint-cpp
  • python3 tools/test.py --mode=release sea
  • make -j22 test-only

AI disclosure: I used a coding agent for the investigation, patch, benchmarks, and PR text. It checked the resource lifetime against the source, built Node.js, and ran the tests above. I approved the PR and will handle review comments myself.

Copilot AI lite review requested due to automatic review settings September 7, 2026 11:55
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/startup

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@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 Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

@colinhacks
colinhacks force-pushed the src-sea-borrow-snapshot-data branch from e9e9b50 to ab51407 Compare September 7, 2026 12:24
@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.95652% with 3 lines in your changes missing coverage. Please review.
βœ… Project coverage is 89.99%. Comparing base (46bbfc4) to head (f385b3e).

Files with missing lines Patch % Lines
src/node_snapshotable.cc 90.00% 1 Missing and 1 partial ⚠️
src/node.cc 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #65876   +/-   ##
=======================================
  Coverage   89.98%   89.99%           
=======================================
  Files         784      784           
  Lines      268361   268373   +12     
  Branches    51117    51123    +6     
=======================================
+ Hits       241478   241512   +34     
+ Misses      17438    17425   -13     
+ Partials     9445     9436    -9     
Files with missing lines Coverage Ξ”
src/env.h 97.26% <100.00%> (+0.03%) ⬆️
src/node.cc 76.39% <50.00%> (+0.02%) ⬆️
src/node_snapshotable.cc 73.62% <90.00%> (+0.06%) ⬆️

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

@colinhacks colinhacks closed this Sep 7, 2026
@colinhacks colinhacks reopened this Sep 7, 2026
@panva panva added author ready PRs with CI started, the required approvals, and no outstanding review comments. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Sep 8, 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 8, 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 9, 2026
@panva

panva commented Sep 9, 2026

Copy link
Copy Markdown
Member

cc @nodejs/single-executable

@nodejs-github-bot nodejs-github-bot added the lacks-second-approval Commit Queue PRs awaiting a second collaborator approval or completion of the required wait. label Sep 9, 2026
Signed-off-by: Colin McDonnell <3084745+colinhacks@users.noreply.github.com>
@colinhacks
colinhacks force-pushed the src-sea-borrow-snapshot-data branch from ab51407 to f385b3e Compare September 11, 2026 18:33
@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. lacks-second-approval Commit Queue PRs awaiting a second collaborator approval or completion of the required wait. labels Sep 11, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Commit Queue failed

   ⚠  Could not retrieve the email or name of the PR author's from user's GitHub profile!
   ⚠  Commits were pushed since the last approving review:
   ⚠  - src: avoid copying SEA snapshot data
   βœ–  This PR needs to wait 66 more hours to land (or 0 minutes if there is one more approval)
   βœ–  GitHub CI is still running
   ⚠  Commits were pushed after the last Full PR CI run:
   ⚠  - src: avoid copying SEA snapshot data

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
- Loading data for nodejs/node/pull/65876
βœ”  Done loading data for nodejs/node/pull/65876
----------------------------------- PR info ------------------------------------
Title      src: avoid copying SEA snapshot data (#65876)
   ⚠  Could not retrieve the email or name of the PR author's from user's GitHub profile!
Branch     colinhacks:src-sea-borrow-snapshot-data -> nodejs:main
Labels     c++, author ready, needs-ci, commit-queue, lacks-second-approval
Commits    1
 - src: avoid copying SEA snapshot data
Committers 1
 - Colin McDonnell <3084745+colinhacks@users.noreply.github.com>
PR-URL: https://github.com/nodejs/node/pull/65876
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/65876
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
--------------------------------------------------------------------------------
   ⚠  Commits were pushed since the last approving review:
   ⚠  - src: avoid copying SEA snapshot data
   β„Ή  This PR was created on Mon, 07 Sep 2026 11:55:08 GMT
   βœ”  Approvals: 1
   βœ”  - Filip Skokan (@panva) (TSC): https://github.com/nodejs/node/pull/65876#pullrequestreview-5144522069
   βœ–  This PR needs to wait 66 more hours to land (or 0 minutes if there is one more approval)
   βœ–  GitHub CI is still running
   β„Ή  Last Full PR CI on 2026-09-08T16:48:40Z: https://ci.nodejs.org/job/node-test-pull-request/77203/
   ⚠  Commits were pushed after the last Full PR CI run:
   ⚠  - src: avoid copying SEA snapshot data
- Querying data for job/node-test-pull-request/77203/
βœ”  Build data downloaded
   βœ”  Last Jenkins CI successful
--------------------------------------------------------------------------------
   βœ”  Aborted `git node land` session in /home/runner/work/node/node/.ncu

View workflow run

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++. commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants