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

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.

Signed-off-by: Colin McDonnell <3084745+colinhacks@users.noreply.github.com>
@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 90.19%. Comparing base (718cfe4) to head (ab51407).
⚠️ Report is 12 commits behind head on main.

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   92.37%   90.19%   -2.18%     
==========================================
  Files         417      771     +354     
  Lines      188656   264921   +76265     
  Branches    28838    50336   +21498     
==========================================
+ Hits       174268   238950   +64682     
- Misses      14051    16954    +2903     
- Partials      337     9017    +8680     
Files with missing lines Coverage Δ
src/env.h 98.38% <100.00%> (ø)
src/node.cc 76.65% <50.00%> (ø)
src/node_snapshotable.cc 73.59% <90.00%> (ø)

... and 482 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

3 participants