Skip to content

perf(parser): move kinds field of Modifiers to first#20833

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

perf(parser): move kinds field of Modifiers to first#20833
graphite-app[bot] merged 1 commit intomainfrom
om/03-28-perf_parser_move_kinds_field_of_modifiers_to_first

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Mar 29, 2026

Tiny perf optimization. Re-order fields of Modifiers to put kinds first (offset 0), as it's far more often accessed than offsets field. This removes the need for offsetting when accessing Modifier::kinds - a pointer to Modifers is a pointer to kinds.

@github-actions github-actions bot added A-parser Area - Parser C-performance Category - Solution not expected to change functional behavior, only performance labels Mar 29, 2026
Copy link
Copy Markdown
Member Author

overlookmotel commented Mar 29, 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.

@overlookmotel overlookmotel marked this pull request as ready for review March 29, 2026 01:28
Copilot AI review requested due to automatic review settings March 29, 2026 01:28
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

Reorders fields in Modifiers to place the frequently accessed kinds bitfield at offset 0 for a small parser performance optimization.

Changes:

  • Add #[repr(C)] and reorder Modifiers fields so kinds is first.
  • Update Modifiers::empty() initializer order to match the new field layout.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 29, 2026

Merging this PR will not alter performance

✅ 48 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing om/03-28-perf_parser_move_kinds_field_of_modifiers_to_first (f72f108) with om/03-29-perf_parser_add_modifiers_contains_accessibility_ (2a06835)

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.

@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

  • Mar 29, 3:34 PM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Mar 29, 3:40 PM UTC: The Graphite merge queue removed this pull request due to removal of a downstack PR #20820.
  • Mar 29, 3:40 PM UTC: camc314 added this pull request to the Graphite merge queue.
  • Mar 29, 3:41 PM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Mar 29, 3:41 PM UTC: The merge label '0-merge' was removed. This PR will no longer be merged by the Graphite merge queue
  • Mar 29, 3:42 PM UTC: camc314 added this pull request to the Graphite merge queue.
  • Mar 29, 4:19 PM UTC: The Graphite merge queue removed this pull request due to downstack failures on PR #20820.
  • Mar 29, 4:47 PM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Mar 29, 4:52 PM UTC: graphite-app added this pull request to the Graphite merge queue.
  • Mar 29, 4:55 PM UTC: Merged by the Graphite merge queue.

@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-29-perf_parser_add_modifiers_contains_accessibility_ branch from 8176e92 to 290d0c4 Compare March 29, 2026 15:45
graphite-app bot pushed a commit that referenced this pull request Mar 29, 2026
Tiny perf optimization. Re-order fields of `Modifiers` to put `kinds` first (offset 0), as it's far more often accessed than `offsets` field. This removes the need for offsetting when accessing `Modifier::kinds` - a pointer to `Modifers` is a pointer to `kinds`.
@graphite-app graphite-app bot force-pushed the om/03-28-perf_parser_move_kinds_field_of_modifiers_to_first branch from 20f97bf to ac87f17 Compare March 29, 2026 15:45
@graphite-app graphite-app bot force-pushed the om/03-29-perf_parser_add_modifiers_contains_accessibility_ branch from 290d0c4 to 2a06835 Compare March 29, 2026 16:40
Tiny perf optimization. Re-order fields of `Modifiers` to put `kinds` first (offset 0), as it's far more often accessed than `offsets` field. This removes the need for offsetting when accessing `Modifier::kinds` - a pointer to `Modifers` is a pointer to `kinds`.
@graphite-app graphite-app bot force-pushed the om/03-28-perf_parser_move_kinds_field_of_modifiers_to_first branch from ac87f17 to f72f108 Compare March 29, 2026 16:41
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Mar 29, 2026
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 29, 2026
Base automatically changed from om/03-29-perf_parser_add_modifiers_contains_accessibility_ to main March 29, 2026 16:53
@graphite-app graphite-app bot merged commit f72f108 into main Mar 29, 2026
37 checks passed
@graphite-app graphite-app bot deleted the om/03-28-perf_parser_move_kinds_field_of_modifiers_to_first branch March 29, 2026 16:55
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