Skip to content

perf(ast_tools): combine 2 loops over enum variants#21705

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/04-24-perf_ast_tools_combine_2_loops_over_enum_variants
Apr 24, 2026
Merged

perf(ast_tools): combine 2 loops over enum variants#21705
graphite-app[bot] merged 1 commit intomainfrom
om/04-24-perf_ast_tools_combine_2_loops_over_enum_variants

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Apr 24, 2026

Follow-on after #21653. Combine 2 loops over enums' variants into a single loop. Should be a little faster.

Copy link
Copy Markdown
Member Author

overlookmotel commented Apr 24, 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 self-assigned this Apr 24, 2026
@overlookmotel overlookmotel added A-ast-tools Area - AST tools C-performance Category - Solution not expected to change functional behavior, only performance labels Apr 24, 2026 — with Graphite App
@overlookmotel overlookmotel marked this pull request as ready for review April 24, 2026 12:07
Copilot AI review requested due to automatic review settings April 24, 2026 12:07
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 optimizes ast_tools code generation for enum node_id() accessors by merging two separate variant-validation passes into a single loop, reducing repeated iteration work during generation.

Changes:

  • Combine “all variants have node_id-capable inner structs” and “all variants boxed” checks into one pass in generate_for_enum.
  • Remove the now-unneeded type_has_node_id helper and related import.
  • Keep generated output behavior the same (including conditional #[inline(always)] when all variants are boxed).

@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app Bot commented Apr 24, 2026

Merge activity

Follow-on after #21653. Combine 2 loops over enums' variants into a single loop. Should be a little faster.
@graphite-app graphite-app Bot force-pushed the om/04-24-perf_ast_tools_combine_2_loops_over_enum_variants branch from 69a8b6c to fa66a95 Compare April 24, 2026 13:03
@graphite-app graphite-app Bot merged commit fa66a95 into main Apr 24, 2026
25 checks passed
@graphite-app graphite-app Bot deleted the om/04-24-perf_ast_tools_combine_2_loops_over_enum_variants branch April 24, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast-tools Area - AST tools 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.

2 participants