Skip to content

Conversation

@camchenry
Copy link
Member

@camchenry camchenry commented Oct 16, 2025

Switching these rules to use a match node.kind() expression rather than multiple if let statements. Should be faster because we check node.kind() fewer times, plus the linter codegen recognizes this pattern automatically and can optimize skipping this rule when not needed.

+1% on all linter benchmarks.

@github-actions github-actions bot added A-linter Area - Linter C-performance Category - Solution not expected to change functional behavior, only performance labels Oct 16, 2025
Copy link
Member Author

camchenry commented Oct 16, 2025


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 hot fixes, skip the queue and merge this PR next

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.

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 16, 2025

CodSpeed Performance Report

Merging #14648 will not alter performance

Comparing 10-15-perf_linter_rearrange_rules_for_node_type_analysis (46ec4b6) with main (73f2cbb)

Summary

✅ 4 untouched
⏩ 33 skipped1

Footnotes

  1. 33 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.

@camchenry camchenry marked this pull request as ready for review October 16, 2025 16:11
@camchenry camchenry requested a review from camc314 as a code owner October 16, 2025 16:11
Copilot AI review requested due to automatic review settings October 16, 2025 16:11
Copy link
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 linter rule implementations to use a single match on node.kind() instead of multiple if let chains, aiming for fewer kind() evaluations and improved performance.

  • Consolidates conditional logic into match arms for PreferArrayFind.
  • Converts two separate pattern checks into guarded match arms for NoUnreadableArrayDestructuring.

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
crates/oxc_linter/src/rules/unicorn/prefer_array_find.rs Reorganizes multiple pattern-specific if let checks into grouped match arms for different AstKind variants.
crates/oxc_linter/src/rules/unicorn/no_unreadable_array_destructuring.rs Replaces sequential if let pattern checks with a match expression using guard clauses.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Oct 16, 2025
Copy link
Contributor

camc314 commented Oct 16, 2025

Merge activity

Switching these rules to use a `match node.kind()` expression rather than multiple `if let` statements. Should be faster because we check `node.kind()` fewer times, plus the linter codegen recognizes this pattern automatically and can optimize skipping this rule when not needed.

+1% on all linter benchmarks.
@graphite-app graphite-app bot force-pushed the 10-15-perf_linter_rearrange_rules_for_node_type_analysis branch from 46ec4b6 to f2c33f5 Compare October 16, 2025 16:19
@graphite-app graphite-app bot merged commit f2c33f5 into main Oct 16, 2025
20 checks passed
@graphite-app graphite-app bot deleted the 10-15-perf_linter_rearrange_rules_for_node_type_analysis branch October 16, 2025 16:23
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter 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