Skip to content

refactor(parser): make Modifier Copy#20824

Closed
overlookmotel wants to merge 1 commit intoom/03-28-perf_parser_defer_calculation_of_modifier_spansfrom
om/03-28-refactor_parser_make_modifier_copy_
Closed

refactor(parser): make Modifier Copy#20824
overlookmotel wants to merge 1 commit intoom/03-28-perf_parser_defer_calculation_of_modifier_spansfrom
om/03-28-refactor_parser_make_modifier_copy_

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Mar 28, 2026

#20823 reduced Modifier to 8 bytes. So it's now pointless passing around &Modifiers (also 8 bytes).

Make Modifier Copy and pass around owned Modifiers instead.

@github-actions github-actions bot added the A-parser Area - Parser label Mar 28, 2026
@github-actions github-actions bot added the C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior label Mar 28, 2026
@overlookmotel overlookmotel marked this pull request as ready for review March 28, 2026 16:23
Copilot AI review requested due to automatic review settings March 28, 2026 16:24
Copy link
Copy Markdown
Member Author

overlookmotel commented Mar 28, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


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

Refactors the parser’s Modifier value type to be trivially copyable now that it’s only 8 bytes, reducing unnecessary &Modifier passing and simplifying call sites in modifier validation and diagnostics paths.

Changes:

  • Derive Copy for Modifier and change Modifier::span to take self by value.
  • Update parser modifier-checking helpers and verify_modifiers callback signatures to accept Modifier by value.
  • Adjust diagnostics call sites to pass owned Modifier values instead of references.

Reviewed changes

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

File Description
crates/oxc_parser/src/modifiers.rs Makes Modifier Copy, updates span receiver and internal modifier validation APIs to take modifiers by value.
crates/oxc_parser/src/js/module.rs Updates a diagnostics call site to pass an owned Modifier instead of &Modifier.
crates/oxc_parser/src/diagnostics.rs Changes modifier-related diagnostic constructors to accept Modifier by value to match the new value semantics.

@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-refactor_parser_make_modifier_copy_ (bbef4f3) with om/03-28-perf_parser_defer_calculation_of_modifier_spans (e6c5fb8)

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.

@overlookmotel
Copy link
Copy Markdown
Member Author

Codspeed says (surprisingly) that this is a small perf regression. So closing.

@overlookmotel overlookmotel deleted the om/03-28-refactor_parser_make_modifier_copy_ branch March 29, 2026 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-parser Area - Parser C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants