Skip to content

src: avoid copying SEA snapshot data - #65841

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

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

Conversation

@colinhacks

Copy link
Copy Markdown

Description

When a single executable application uses a startup snapshot, Node.js currently copies the complete V8 startup-data region out of the embedded SEA resource during deserialization. The resource remains mapped for the process lifetime, so that copy is unnecessary.

This change lets the SEA loader borrow the V8 startup data directly from the executable image. File-backed and embedder-provided snapshot blobs keep the existing owned-copy behavior because their input buffers do not have the required lifetime.

Results

The following results are medians from 240 randomized, interleaved launches after 30 warmup launches on Linux x64 (Intel Xeon Platinum 8481C). The baseline and patched executables were built from 6f41e415639b5ec3dd816e44945cc73b4d7651e3.

SEA workload Before After Difference
Empty snapshot 28.335 ms 26.610 ms -1.725 ms (-6.1%)
Computation in snapshot 28.131 ms 26.491 ms -1.640 ms (-5.8%)
100,000 objects in snapshot 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: a coding agent prepared the investigation, patch, measurements, and description under the contributor's direction. The agent verified the lifetime invariant against the source, built Node.js, and ran the validation above. The contributor approved opening this pull request and will respond personally during review.

Copilot AI lite review requested due to automatic review settings September 6, 2026 07:08
@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 6, 2026
@github-actions

github-actions Bot commented Sep 6, 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.

@MikeMcC399

Copy link
Copy Markdown
Contributor

The recommendations in:

advise you should tackle only one issue at a time and that you should not open any new PRs until your first PR has been approved.

You already have #65796 open, which has received reviews, however it has not been approved as yet.

@colinhacks colinhacks closed this Sep 6, 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.

4 participants