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 80.00000% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.99%. Comparing base (5f77f95) to head (d1439f7).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/node_snapshotable.cc 81.81% 3 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.99%   89.99%   -0.01%     
==========================================
  Files         785      785              
  Lines      269347   269358      +11     
  Branches    51307    51313       +6     
==========================================
+ Hits       242395   242403       +8     
- Misses      17452    17459       +7     
+ Partials     9500     9496       -4     
Files with missing lines Coverage Δ
src/env.h 97.26% <100.00%> (+0.03%) ⬆️
src/node.cc 77.12% <50.00%> (+0.02%) ⬆️
src/node_snapshotable.cc 73.63% <81.81%> (+0.03%) ⬆️

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

This comment has been minimized.

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

This comment has been minimized.

@panva panva removed the commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. label Sep 12, 2026
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@colinhacks
colinhacks force-pushed the src-sea-borrow-snapshot-data branch from f385b3e to 6586e1d Compare September 13, 2026 12:34
Signed-off-by: Colin McDonnell <3084745+colinhacks@users.noreply.github.com>
@colinhacks
colinhacks force-pushed the src-sea-borrow-snapshot-data branch from 6586e1d to d1439f7 Compare September 13, 2026 12:36
@panva panva 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 13, 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 13, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

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