-
-
Notifications
You must be signed in to change notification settings - Fork 721
perf(linter): rearrange rules for node type analysis #14648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf(linter): rearrange rules for node type analysis #14648
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via 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. |
CodSpeed Performance ReportMerging #14648 will not alter performanceComparing Summary
Footnotes
|
There was a problem hiding this 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.
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.
46ec4b6 to
f2c33f5
Compare

Switching these rules to use a
match node.kind()expression rather than multipleif letstatements. Should be faster because we checknode.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.