mbe: literal-run fast path in the matcher; one-entry marker cache [html5ever -0.3%] - #84
Open
xmakro wants to merge 1 commit into
Open
mbe: literal-run fast path in the matcher; one-entry marker cache [html5ever -0.3%]#84xmakro wants to merge 1 commit into
xmakro wants to merge 1 commit into
Conversation
Matching stepped every literal token through the full queue machinery: a round of parse_tt_inner plus a queue swap and a parser bump per token. When there is a single live matcher position and the tracker does not observe locations, a run of literal-token locations is now matched directly against the input: once at rule start, so arms that fail on a leading literal never enter the queue at all, and again whenever a matched token leaves a single next position. Failure values and positions are identical to the queue path, and tracking invocations (the diagnostics retry) never take the fast path. Marking spans during transcription hashed the syntax context on every token; a one-entry cache in front of the map now hits on a plain compare, since virtually all tokens in a macro body share one context. html5ever check -0.27%, clap_derive check -0.13%, no real-world regressions.
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.
Follow-up to #57, stacked on #83. Two independent fast paths in the mbe hot loops.
Matcher literal-run fast path. Matching stepped every literal token of an arm through the full queue machinery: a
parse_tt_innerround, a queue swap, and a parser bump per token. When there is a single live matcher position and the tracker does not observe locations, a run of literal-token (and delimiter-marker) locations is now matched directly against the input:Failure values and token positions are identical to the queue path, matching stops at input Eof so the distinct missing-tokens diagnostic still comes from the queue path, and tracking invocations (the diagnostics retry pass) are gated out via a new
Tracker::NEEDS_TRACKINGconst, so they observe every location exactly as before.One-entry marker cache. Marking spans during transcription hashed the syntax context into the marker cache for every token. A one-entry cache in front of the map now hits on a plain compare, since virtually all tokens in a macro body share one syntax context.
Performance (ThinLTO stage2, jemalloc, instructions:u, full scenario, measured on top of the perf stack; base includes #82+#83):
Correctness: stage2 green;
x check compilergreen standalone on this branch; full tests/ui failure set byte-identical to the pre-existing baseline (21301 passed, zero new diffs), which includes the macro diagnostics tests exercising the tracking path.