Repository navigation
perf(parser): green walk_top_level pass (PR4) - #1598
Merged
Merged
Conversation
Contributor
📊 Benchmark Results
vs main branch (2026-06-25)
What do these numbers mean?
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR completes the “lossless-CST-tax removal” work by moving the last remaining per-top-level validation traversal (walk_top_level_once) off the red SyntaxNode cursor and onto a green-tree walk, keeping output byte-identical to the red path and gated behind the existing use_green flag.
Changes:
- Adds green-tree implementations of
walk_top_level_once’s five checks (indentation, custom bare-currency, transaction-body catch-all, error-node recovery classification, org section markers) with stripped-frame offset threading. - Wires both descendants + top-level passes through green implementations when
use_greenis enabled, sharing helpers viapub(super)visibility. - Extends differential fuzzing and corpus-based tests to also assert account/currency occurrence equivalence (produced by the descendants walk).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/rustledger-parser/src/cst/green.rs | Implements green-tree walk_top_level (and includes green descendants walk in this stacked PR) plus corpus extensions to validate byte-identical behavior. |
| crates/rustledger-parser/src/cst/convert.rs | Routes descendants + top-level passes to green versions behind use_green; exposes shared helper/result types to green.rs. |
| crates/rustledger-parser/fuzz/fuzz_targets/fuzz_green_eq_red.rs | Adds equality assertions for account/currency occurrences between green and red parses. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Greens the last red traversal in the conversion: walk_top_level_once (per-top- level-directive validation). A green iteration over the root's direct children threads the stripped-frame offset and dispatches green re-implementations of all five checks — indented-directive (column-0), custom bare-currency, transaction- body catch-all, error-node recovery classification, and org-section-marker comments — producing a byte-identical TopLevelWalkResult. Wired behind use_green. Helpers is_trivia_kind / classify_recovery_error / TopLevelWalkResult made pub(super) and shared with red. Differential (corpus + fuzz, comparing errors + comments) auto-verifies; corpus gains a case per check. clippy --all-targets clean, 284 tests.
robcohen
force-pushed
the
perf/green-walk-top-level
branch
from
June 25, 2026 18:19
d173ba1 to
b2c0cf4
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
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.
What
PR 4 of the lossless-CST-tax removal — greens the last red traversal in the conversion:
walk_top_level_once(per-top-level-directive validation). With #1594/#1595 (directive conversion) and #1596 (walk_descendants), this completes the move of the hot parse path off the redSyntaxNodecursor.How
A green iteration over the root's direct children threads the stripped-frame byte offset (no per-child red-node allocation) and dispatches green re-implementations of all five checks, producing a byte-identical
TopLevelWalkResult:CURRENCYnot paired asNUMBER CURRENCYafter the header,classify_recovery_error(BOM / invalid-account / syntax) + secondary BOM,*-lines in error nodes.is_trivia_kind/classify_recovery_error/TopLevelWalkResultare madepub(super)and shared with the red path. Wired behind the existinguse_greenflag.Verification
clippy --all-targets -D warningsclean.parse_green_eq_red_corpus+fuzz_green_eq_redalready compare errors + section-marker comments, so they auto-verify this pass; corpus gains a case per check (indented, tab-indented, custom bare-currency, body catch-all, valid body tag, error-node, section markers + comment).Performance
Standard 10k-txn workload instruction count added below — the final increment of the green conversion.
🤖 Generated with Claude Code
Measured win on the standard 10k-txn workload
The final green increment: another −7.7%, for a cumulative −30.3% vs the pre-green red baseline. With all four PRs the parse path is fully off the red
SyntaxNodecursor.