perf(parser): remove const generic param from finish_next_inner#19684
Merged
graphite-app[bot] merged 1 commit intomainfrom Feb 25, 2026
Conversation
This was referenced Feb 24, 2026
This was referenced Feb 24, 2026
This was referenced Feb 24, 2026
Member
Author
3bccb19 to
ac33e76
Compare
finish_next_innerfinish_next_inner
Contributor
Merge activity
|
…9684) Replace const generic param from `finish_next_inner`. ```diff - fn finish_next_inner<const REPLACE_SAME_START: bool>(&mut self, kind: Kind) -> Token { + fn finish_next_inner(&mut self, kind: Kind, mode: FinishTokenMode) -> Token { ``` The function is marked `#[inline(always)]` to ensure that `mode` can be statically known from each call site and acts as a const. The perf improvement (5%-8% on `parser_tokens` benchmarks) surprised me. Turns out it's the result of the `#[inline(always)]` (see #19694 which made that change in isolation). Aside from the perf improvement, it's easier to read, and may reduce compile time a bit (as this function is inlined into many call sites).
ac33e76 to
b5d9845
Compare
This was referenced Feb 25, 2026
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.

Replace const generic param from
finish_next_inner.The function is marked
#[inline(always)]to ensure thatmodecan be statically known from each call site and acts as a const.The perf improvement (5%-8% on
parser_tokensbenchmarks) surprised me. Turns out it's the result of the#[inline(always)](see #19694 which made that change in isolation).Aside from the perf improvement, it's easier to read, and may reduce compile time a bit (as this function is inlined into many call sites).