perf: store single source-map segments directly - #116
Closed
luojiyin1987 wants to merge 1 commit into
Closed
luojiyin1987 wants to merge 1 commit into
luojiyin1987 wants to merge 1 commit into
Conversation
Store one segment directly in each mapping. Promote the mapping when a second segment arrives. The many-nodes profile removes 10,000 arrays and 10,000 backing stores. This reduces retained memory by 1.75 MiB.
Contributor
Author
|
Closing this after reviewing the trade-off. The heap reduction is measurable (~1.75 MiB for the many-nodes fixture), but the The profiling work was still useful: it shows that the remaining memory cost is largely structural rather than low-risk allocation waste. I don't think the measured saving justifies the additional representation complexity without evidence of a real workload where this is a bottleneck. |
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
Memory result
The many-nodes raw profile removes 10,000 arrays.
It also removes 10,000 backing stores.
Retained memory decreases by 1,840,000 bytes, or about 1.75 MiB.
The heap snapshot file decreases from 32.8 MiB to 31.8 MiB.
Same-machine A/B benchmark
Base is 1fd0f0f. Head is 5508c40.
Both revisions use the same machine, Node version, dependencies, and esbuild binary.
The test ran five alternating rounds in AB, BA, AB, BA, AB order.
The existing harness warmed each case and used three samples per round.
The table reports the median across the five rounds.
The CI signal of about 20% did not reproduce on the same machine.
No query pattern shows a stable regression of 10% or more.
The result does not require a multi-segment fast-path change.
Validation