Repository navigation
Conversation
… (bd-akgst1fi) ast-memory parses a directory of .md/.qmd with pampa's reader, retains every AST, and reports allocator traffic, a census of text-carrying fields, Str shape, and a text-run what-if. The study doc records the measurements on claude-notes/plans (AST heap = 88x source, 89% of it Vec<Inline> buffers) and the recommendation to fix node layout rather than add a lifetime to the AST. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…study Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ing decisions Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
…6mn) Every element of a Vec<Inline> occupies size_of::<Inline>() bytes, and most inlines are Str and Space. Link (352 bytes) set that size for all of them. Box the payloads of the variants larger than Str: Quoted, Cite, Code, Math, RawInline, Link, Image, Span, Shortcode, Attr, Insert, Delete, Highlight, EditComment and Custom. A const assertion holds Inline at 8 words (64 bytes native, 32 on wasm32). On claude-notes/plans (26.3 MiB) with perf-harness ast-memory: Vec<Inline> buffers 2058 -> 366 MiB, AST heap 2304 -> 678 MiB (87.7x -> 25.8x of source), peak RSS 2.75 -> 0.87 GiB, parse wall 7.7 -> 6.5 s. Serde is unaffected (Box<T> serializes as T). Call sites change mechanically: constructions gain Box::new, destructuring patterns on boxed payloads become a binding plus field access, and or-patterns mixing boxed and unboxed variants are split. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This branch has not been 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.
Integration branch for epic bd-4x6kih4c. Draft: stages land here as they complete.
Why
A study (bd-akgst1fi,
claude-notes/plans/2026-11-12-ast-string-storage-study.md) measured the parsed AST ofclaude-notes/plans(26.3 MiB of Markdown) at 2,304 MiB of heap, 88x the source. 89% of that isVec<Inline>buffers:Inlineis 360 bytes (192 on wasm32), sized byLink, and everySpacepays for it.The study recommends against adding a lifetime to the AST and for fixing node layout instead.
Stages
ast-memorycensus tool inperf-harnessInlinevariants.Inline360 → 64 bytes; AST heap 2,304 → 678 MiB (87.7× → 25.8× of source); peak RSS 2.75 → 0.87 GiBBlockvariantsAttr+AttrSourceInfofor the empty caseOriginalsource-info hullecowfirst)u32offsets, shared file contentMeasuring
🤖 Generated with Claude Code