Repository navigation
perf(cli): Hash debug ID input without concatenating it - #2602
Merged
Merged
Conversation
The debug ID hash of a bundle and its sourcemap built `${js}\0${map}`
first. For a 50 MB bundle that copy added about 200 MB of peak RSS.
contentToDebugId now takes parts and feeds each to the hash, which
gives the same digest; a test pins the existing IDs.
Two scans also do less work:
- injectDebugId no longer repeats the runtime registration check for an
ID it already checked from the //# debugId= comment.
- readRegisteredDebugId stops at the second distinct registered ID.
Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
BYK
approved these changes
Nov 30, 2026
This branch was successfully deployed
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.
Three small performance fixes in the sourcemap debug ID inject path (
packages/cli/src/lib/sourcemap/debug-id.ts). Debug IDs and inject behavior don't change.contentToDebugId(`${js}\0${map}`). That builds one big string, which V8 then flattens and encodes before hashing.contentToDebugIdnow takes several parts and passes each one tohash.update(), which gives the same digest. Both inputs are already in memory (the JS for the registration scans and the rewrite, the map forJSON.parse), so streaming from disk wouldn't save anything.//# debugId=comment but doesn't register that ID at runtime,injectDebugIdranhasDebugIdRegistrationtwice with the same arguments. Now the second check only runs for an ID that came from the map.readRegisteredDebugId. It stops at the second distinct registered ID. Results stay the same: nothing for no ID or several IDs, and the ID itself when there's exactly one.Before and after
For a ~50 MB minified bundle with a 151 MB sourcemap on Node 24 (medians of 3 runs, each in a fresh process):
injectDebugId: timeinjectDebugId: peak RSSvia @BYK.
--
View Session [Sentry]