Conversation
robhogan
added this pull request to stack #1982
September 26, 2026 07:54
robhogan
force-pushed
the
pr1978
branch
3 times, most recently
from
September 26, 2026 08:39
b61cc51 to
9e5b6e9
Compare
robhogan
marked this pull request as ready for review
September 26, 2026 10:39
This was referenced Sep 26, 2026
`MappingsConsumer` decoded the VLQ of every mapping twice - once through its cache and once more with the result discarded - since the consumer was added in ccd508c. This removes the second call. `composeSourceMaps` with a bundle map and its Hermes map is 13.6% faster (95% CI 13.3-13.8%; 2,088ms -> 1,801ms on our benchmark app*), with byte-identical output. Composition memory is within 0.2% (-1MB*). | | Time (median) | vs previous | vs `main` | Composition memory* | vs previous | vs `main` | Peak RSS | |---|---|---|---|---|---|---|---| | `main` | 2,088ms (2,082 to 2,094) | | | 1,070MB (1,070 to 1,070) | | | 1,664MB | | This diff | 1,801ms (1,794 to 1,806) | -13.6% (-13.8 to -13.3) | -13.6% (-13.8 to -13.3) | 1,069MB (1,069 to 1,069) | -0.1% (-0.2 to -0.1) | -0.1% (-0.2 to -0.1) | 1,663MB | ## Changelog ``` - **[Performance]**: Don't decode source map segments twice in `metro-source-map`'s `Consumer` ``` ## Test plan ``` yarn jest packages/metro-source-map packages/metro-symbolicate yarn flow check ``` \* Benchmark: Mattermost Mobile 2.45.0 (React Native 0.83.9, Metro 0.83.7), iOS release bundle, unminified: 7,086 sources, 52.6MB bundle, 82.4MB flat source map. Composed with its `hermesc -O -output-source-map` map (hermes-compiler 0.14.1; 10.7MB, 1.84M segments). Timings are `composeSourceMaps` alone, excluding JSON parsing, over 105 rounds on Node 22.13.1 on an M5 Pro; each round runs `main`, every diff in this stack and a memory baseline, in a shuffled order. Figures are medians with 95% bootstrap confidence intervals - for changes, of the per-round paired ratio. Composition memory is peak RSS less that of the same process parsing both maps without composing them (594MB).
There was a problem hiding this comment.
Copilot review overview
馃煝 Approval recommended
No unresolved issues were identified.
Review effort: Lite
Findings: None
What changed in this PR
Removes redundant VLQ decoding in MappingsConsumer, improving source-map composition performance while preserving output.
Changes:
- Eliminates the discarded second decode.
- Retains cached mapping behavior.
| File | Description |
|---|---|
packages/鈥媘etro-source-map/鈥媠rc/鈥婥onsumer/鈥婱appingsConsumer.js |
Removes redundant VLQ decoding. |
馃挕 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
vzaidman
approved these changes
Sep 28, 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.
Delete one line to make merging source maps 13% faster.
MappingsConsumerdecoded the VLQ of every mapping twice - once through its cache and once more with the result discarded, ever since the consumer was added in ccd508c. This removes the second call - a stray line that never did anything except take time (it definitely doesn't mutate the input, which is a string).composeSourceMapswith a bundle map and its Hermes map is 13.6% faster (95% CI 13.3-13.8%; 2,088ms -> 1,801ms on our benchmark app*), with byte-identical output. Composition memory is within 0.2% (-1MB*).mainmainmainChangelog
Test plan
* Benchmark: Mattermost Mobile 2.45.0 (React Native 0.83.9, Metro 0.83.7), iOS release bundle, unminified: 7,086 sources, 52.6MB bundle, 82.4MB flat source map. Composed with its
hermesc -O -output-source-mapmap (hermes-compiler 0.14.1; 10.7MB, 1.84M segments). Timings arecomposeSourceMapsalone, excluding JSON parsing, over 105 rounds on Node 22.13.1 on an M5 Pro; each round runsmain, every diff in this stack and a memory baseline, in a shuffled order. Figures are medians with 95% bootstrap confidence intervals - for changes, of the per-round paired ratio. Composition memory is peak RSS less that of the same process parsing both maps without composing them (594MB).