perf(snapshot): minify snapshot sources#35183
Open
nathanwhit wants to merge 1 commit into
Open
Conversation
8ec981d to
fda6d6c
Compare
fda6d6c to
e98dbf2
Compare
e98dbf2 to
47ebe62
Compare
bartlomieju
reviewed
Jun 13, 2026
| console.error(JSON.stringify(result.errors, null, 2)); | ||
| Deno.exit(1); | ||
| } | ||
| function escapeNonAscii(code) { |
Member
There was a problem hiding this comment.
Is this even reachable? I thought we have a check that ensures everything is ascii
bartlomieju
approved these changes
Jun 13, 2026
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
This adds build-time minification for extension sources used by the startup snapshot.
When
DENO_SNAPSHOT_MINIFY_SOURCES=1is set, the snapshot build transpiles sources as before, then runs them through Rolldown's minifier with compression and name mangling disabled. This keeps the transform conservative: it removes whitespace/comments without changing binding names or applying semantic compression.The minifier is applied to both sources consumed during snapshot creation and residual lazy extension sources emitted by
cli/snapshot/build.rs. The minified output is asserted to be ASCII at snapshot build time.Release CI now sets
DENO_SNAPSHOT_MINIFY_SOURCES=1for the release artifact builds and the benchmark release build, so release binaries exercise this path.Why
Startup snapshot sources include a large amount of JavaScript/TypeScript text. Minifying those sources substantially reduces the serialized snapshot payload and residual embedded source size, even though it does not meaningfully reduce the deserialized V8 heap graph.
Measurements
Measured on a debug build from
main@upstreamwith:Results:
Validation
Also smoke-tested the minified debug binary with basic execution,
node:path,URL,ReadableStream, andDeno.readTextFile.