perf(parser): add #[inline(always)] to finish_next_inner#19694
perf(parser): add #[inline(always)] to finish_next_inner#19694overlookmotel wants to merge 1 commit intomainfrom
#[inline(always)] to finish_next_inner#19694Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Merging this PR will improve performance by 8.57%
Performance Changes
Comparing Footnotes
|
…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).

No description provided.