Skip to content

perf(parser): add #[inline] to trivial modifier methods#20826

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/03-28-perf_parser_add_inline_to_trivial_modifier_methods
Mar 29, 2026
Merged

perf(parser): add #[inline] to trivial modifier methods#20826
graphite-app[bot] merged 1 commit intomainfrom
om/03-28-perf_parser_add_inline_to_trivial_modifier_methods

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Mar 28, 2026

Add #[inline] to methods of Modifier, Modifiers, and ModifierKinds which are only a few instructions. Compiler very likely inlines them anyway, but it's good to make sure.

Also make Modifier::new a const function, because there's no reason not to.

@github-actions github-actions bot added the A-parser Area - Parser label Mar 28, 2026
@github-actions github-actions bot added the C-performance Category - Solution not expected to change functional behavior, only performance label Mar 28, 2026
@overlookmotel overlookmotel marked this pull request as ready for review March 28, 2026 16:39
Copilot AI review requested due to automatic review settings March 28, 2026 16:39
Copy link
Copy Markdown
Member Author

overlookmotel commented Mar 28, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of 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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds #[inline] annotations to several small, frequently-called helper methods in oxc_parser’s modifier handling to encourage consistent inlining in hot parsing paths.

Changes:

  • Added #[inline] to trivial Modifier constructors/accessors (new, span).
  • Added #[inline] to small Modifiers helpers (empty, new_single, add, contains, kinds).
  • Added #[inline] to ModifierKind::len.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 28, 2026

Merging this PR will not alter performance

✅ 48 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing om/03-28-perf_parser_add_inline_to_trivial_modifier_methods (2208114) with main (eb02c88)2

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (055a7ac) during the generation of this report, so eb02c88 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@overlookmotel overlookmotel changed the base branch from om/03-28-refactor_parser_modifiers_add_take_modifier_as_param to graphite-base/20826 March 29, 2026 00:55
@overlookmotel overlookmotel force-pushed the om/03-28-perf_parser_add_inline_to_trivial_modifier_methods branch from 92c8d6f to 328e6da Compare March 29, 2026 00:55
@overlookmotel overlookmotel changed the base branch from graphite-base/20826 to om/03-28-perf_parser_defer_calculation_of_modifier_spans March 29, 2026 01:11
@overlookmotel overlookmotel force-pushed the om/03-28-perf_parser_add_inline_to_trivial_modifier_methods branch from 328e6da to cee52c3 Compare March 29, 2026 01:12
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Mar 29, 2026
Copy link
Copy Markdown
Contributor

camc314 commented Mar 29, 2026

Merge activity

@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 29, 2026
@graphite-app graphite-app bot force-pushed the om/03-28-perf_parser_defer_calculation_of_modifier_spans branch from e6c5fb8 to 45d7efb Compare March 29, 2026 15:43
graphite-app bot pushed a commit that referenced this pull request Mar 29, 2026
Add `#[inline]` to methods of `Modifier`, `Modifiers`, and `ModifierKinds` which are only a few instructions. Compiler very likely inlines them anyway, but it's good to make sure.

Also make `Modifier::new` a const function, because there's no reason not to.
@graphite-app graphite-app bot force-pushed the om/03-28-perf_parser_add_inline_to_trivial_modifier_methods branch from cee52c3 to c4b3d05 Compare March 29, 2026 15:44
@graphite-app graphite-app bot force-pushed the om/03-28-perf_parser_defer_calculation_of_modifier_spans branch from 45d7efb to 055a7ac Compare March 29, 2026 16:38
Add `#[inline]` to methods of `Modifier`, `Modifiers`, and `ModifierKinds` which are only a few instructions. Compiler very likely inlines them anyway, but it's good to make sure.

Also make `Modifier::new` a const function, because there's no reason not to.
@graphite-app graphite-app bot force-pushed the om/03-28-perf_parser_add_inline_to_trivial_modifier_methods branch from c4b3d05 to 2208114 Compare March 29, 2026 16:39
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Mar 29, 2026
Base automatically changed from om/03-28-perf_parser_defer_calculation_of_modifier_spans to main March 29, 2026 16:43
@graphite-app graphite-app bot merged commit 2208114 into main Mar 29, 2026
37 checks passed
@graphite-app graphite-app bot deleted the om/03-28-perf_parser_add_inline_to_trivial_modifier_methods branch March 29, 2026 16:48
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-parser Area - Parser C-performance Category - Solution not expected to change functional behavior, only performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants