chore: add source-map heap profiling harness - #115
Merged
Merged
Conversation
Adds scripts/profile-source-map-heap.mjs for capturing V8 heap snapshots at build/raw/range phases. Verifies lazy lineStarts and sourceGapPrefix do not exist in retained heap until first use. Fixtures: many-nodes (10k paragraphs), segments (256 KiB high density), fenced-code (1 MiB code block), urls (1000 definitions). Documents analysis method in CONTRIBUTING.md. Not added to CI — heap snapshots are large and V8-version-dependent.
- fenced-code fixture: replace O(n²) while-loop with calculated repeat count; fixture now produces ~1 MiB without GC pressure - raw phase: remove blanket try-catch on getRaw(); owned nodes with snapshotted offsets should always succeed - range phase: catch only RangeError (non-contiguous ranges); real bugs now propagate instead of being swallowed - fix comment: fenced code does have code-value source mapping
- Remove unused writeFileSync import and collectNodes function - CONTRIBUTING.md: fenced-code description 'no segments' → 'with source-map segments' - CONTRIBUTING.md: 'every text node' → 'every mapped value node' - CONTRIBUTING.md: qualify sourceGapPrefix with 'for multi-segment ranges'
Contributor
Author
|
Analyzed the generated heap snapshots. The profiling harness is giving useful structural evidence:
This confirms the intended lazy-index behavior and gives us a useful boundary for future memory work. For now, I don't think we should pursue further source-map memory optimization without evidence from real workloads. In particular, changing the segment representation would add complexity and should require profiling that shows segment density is a real production bottleneck. A useful final comparison, if needed later, would be |
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.
Adds scripts/profile-source-map-heap.mjs for capturing V8 heap
snapshots at build/raw/range phases. Verifies lazy lineStarts and
sourceGapPrefix do not exist in retained heap until first use.
Fixtures: many-nodes (10k paragraphs), segments (256 KiB high
density), fenced-code (1 MiB code block), urls (1000 definitions).
Documents analysis method in CONTRIBUTING.md. Not added to CI —
heap snapshots are large and V8-version-dependent.