Skip to content

Inline small identifier and span helpers - #2420

Closed
fyrsta7 wants to merge 1 commit into
apache:mainfrom
fyrsta7:perf/inline-ident-span-helpers
Closed

Inline small identifier and span helpers#2420
fyrsta7 wants to merge 1 commit into
apache:mainfrom
fyrsta7:perf/inline-ident-span-helpers

Conversation

@fyrsta7

@fyrsta7 fyrsta7 commented Aug 2, 2026

Copy link
Copy Markdown

Summary

This adds #[inline] to two very small helper methods: Word::to_ident and TokenWithSpan::at.

Why this can improve performance

Both helpers are small wrapper-style methods used while constructing identifiers and token spans. Marking them inline gives the optimizer more room to remove call overhead on parser/tokenizer paths that call these helpers frequently.

Validation

  • git diff --check
  • cargo check

Benchmark

Current machine, release microbenchmark, 9 samples, median:

Benchmark Base This change Delta
1024 identifier/span helper calls 42,798.232 ns 38,391.700 ns 10.30% faster

@fyrsta7
fyrsta7 marked this pull request as ready for review August 2, 2026 17:32
@fyrsta7 fyrsta7 closed this Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant