Skip to content

perf(ast): mark AstKind::address as #[inline]#20586

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/02-15-perf_ast_mark_astkind_address_as_inline_
Mar 20, 2026
Merged

perf(ast): mark AstKind::address as #[inline]#20586
graphite-app[bot] merged 1 commit intomainfrom
om/02-15-perf_ast_mark_astkind_address_as_inline_

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Mar 20, 2026

Similar to #20585. As AstKind's variants are all structs (no enums any more), and all structs have an AstKind, AstKind::address method boils down to a no-op. So mark it #[inline].

Also remove some defunct code from AstKind codegen which was handling when an AstKind refers to an enum. This circumstance is no longer possible, so remove this code.

Copy link
Copy Markdown
Member Author

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

@github-actions github-actions bot added the C-performance Category - Solution not expected to change functional behavior, only performance label Mar 20, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 20, 2026

Merging this PR will not alter performance

✅ 53 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing om/02-15-perf_ast_mark_astkind_address_as_inline_ (79deba6) with om/02-15-perf_ast_mark_astkind_span_as_inline_ (9eaf443)2

Open in CodSpeed

Footnotes

  1. 3 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 om/02-15-perf_ast_mark_astkind_span_as_inline_ (c9edd39) during the generation of this report, so 00ee51b was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

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

Marks AstKind::address as #[inline] and simplifies AstKind codegen based on the invariant that AstKind variants only wrap structs (not enums), keeping address retrieval essentially a no-op/pointer read.

Changes:

  • Add #[inline] to GetAddress for AstKind::address (both generator + generated output).
  • Remove defunct enum-handling branches in AstKind generator when building has_kind/address match arms.
  • Add brief documentation clarifying why AstKind::address is a single-instruction operation.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
tasks/ast_tools/src/generators/ast_kind.rs Simplifies address match-arm generation and annotates AstKind::address with #[inline] + docs.
crates/oxc_ast/src/generated/ast_kind.rs Regenerates AstKind output with the new #[inline] + docs on address().

@overlookmotel overlookmotel self-assigned this Mar 20, 2026
@overlookmotel overlookmotel force-pushed the om/02-15-perf_ast_mark_astkind_span_as_inline_ branch from 9eaf443 to c9edd39 Compare March 20, 2026 22:02
@overlookmotel overlookmotel force-pushed the om/02-15-perf_ast_mark_astkind_address_as_inline_ branch from d7bf984 to 79deba6 Compare March 20, 2026 22:02
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Mar 20, 2026
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app bot commented Mar 20, 2026

Merge activity

Similar to #20585. As `AstKind`'s variants are all structs (no enums any more), and all structs have an `AstKind`, `AstKind::address` method boils down to a no-op. So mark it `#[inline]`.

Also remove some defunct code from `AstKind` codegen which was handling when an `AstKind` refers to an enum. This circumstance is no longer possible, so remove this code.
@graphite-app graphite-app bot force-pushed the om/02-15-perf_ast_mark_astkind_span_as_inline_ branch from c9edd39 to 3420abb Compare March 20, 2026 22:20
@graphite-app graphite-app bot requested review from camc314 and leaysgur as code owners March 20, 2026 22:20
@graphite-app graphite-app bot force-pushed the om/02-15-perf_ast_mark_astkind_address_as_inline_ branch from 79deba6 to 89946e1 Compare March 20, 2026 22:21
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 20, 2026
Base automatically changed from om/02-15-perf_ast_mark_astkind_span_as_inline_ to main March 20, 2026 22:30
@graphite-app graphite-app bot merged commit 89946e1 into main Mar 20, 2026
26 checks passed
@graphite-app graphite-app bot deleted the om/02-15-perf_ast_mark_astkind_address_as_inline_ branch March 20, 2026 22:31
costajohnt pushed a commit to costajohnt/oxc that referenced this pull request Mar 22, 2026
Similar to oxc-project#20585. As `AstKind`'s variants are all structs (no enums any more), and all structs have an `AstKind`, `AstKind::address` method boils down to a no-op. So mark it `#[inline]`.

Also remove some defunct code from `AstKind` codegen which was handling when an `AstKind` refers to an enum. This circumstance is no longer possible, so remove this code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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