Repository navigation
perf(core): avoid duplicating lazy ESM snapshot sources - #36262
Merged
nathanwhit merged 1 commit intoJul 23, 2026
Merged
nathanwhit merged 1 commit into
nathanwhit merged 1 commit into
Conversation
nathanwhit
marked this pull request as ready for review
July 22, 2026 23:44
bartlomieju
pushed a commit
that referenced
this pull request
Jul 23, 2026
## Summary - track lazy ESM specifiers alongside lazy JS specifiers while externalizing snapshot sources - serialize empty external-string slots for unconsumed lazy sources already present in the residual source table - assert that an unconsumed lazy ESM slot is empty and still loads successfully after restoring the snapshot ## Why The CLI snapshot sidecar retained all 615,312 bytes of its 104 unconsumed lazy ESM sources. The same sources are already embedded in the residual source table for first-use loading. Unconsumed lazy JS sources already used empty sidecar slots; this applies the same treatment to lazy ESM while preserving external-reference indices. This does not add runtime decompression or a writable source buffer. The source remains available from the existing residual table. ## Size impact macOS arm64 release build with `DENO_SNAPSHOT_MINIFY_SOURCES=1`: | | Before | After | Change | |---|---:|---:|---:| | CLI snapshot | 2,550,903 | 1,935,591 | -615,312 bytes | | `__TEXT,__const` | 24,557,528 | 23,942,216 | -615,312 bytes | | linked binary | 119,975,968 | 119,348,512 | -627,456 bytes | The V8 blob is unchanged at 1,604,320 bytes; the sidecar drops from 946,575 to 331,263 bytes. ## Validation - `./tools/format.js --check libs/core/runtime/bindings.rs libs/core/runtime/jsruntime.rs libs/core/runtime/tests/snapshot.rs` - `cargo test --locked -p deno_core`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Why
The CLI snapshot sidecar retained all 615,312 bytes of its 104 unconsumed lazy ESM sources. The same sources are already embedded in the residual source table for first-use loading. Unconsumed lazy JS sources already used empty sidecar slots; this applies the same treatment to lazy ESM while preserving external-reference indices.
This does not add runtime decompression or a writable source buffer. The source remains available from the existing residual table.
Size impact
macOS arm64 release build with
DENO_SNAPSHOT_MINIFY_SOURCES=1:__TEXT,__constThe V8 blob is unchanged at 1,604,320 bytes; the sidecar drops from 946,575 to 331,263 bytes.
Validation
./tools/format.js --check libs/core/runtime/bindings.rs libs/core/runtime/jsruntime.rs libs/core/runtime/tests/snapshot.rscargo test --locked -p deno_core