perf(linter/eslint/no-useless-call): fast-path static callees#24077
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors and optimizes the eslint/no-useless-call lint rule’s hot path by adding a direct classifier for common static-member callees (foo.call(...) / foo.apply(...)) while preserving the existing fallback for more complex callee shapes (parenthesized, chained/optional, computed).
Changes:
- Introduce
classify_callee+CallOrApplyto quickly recognize.call/.applyonExpression::StaticMemberExpressionbefore the more general member-expression handling. - Consolidate argument-shape validation into
CallOrApply::has_valid_argumentsand simplify the mainrunflow. - Add regression coverage for parenthesized callee forms like
(foo.call)(...)/(obj.foo.apply)(...)and update the corresponding insta snapshot.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/oxc_linter/src/rules/eslint/no_useless_call.rs | Adds a fast callee classifier for .call/.apply and refactors argument gating to reduce work on non-matching calls. |
| crates/oxc_linter/src/snapshots/eslint_no_useless_call.snap | Updates snapshots to reflect newly-covered parenthesized .call / .apply failure cases. |
Merging this PR will not alter performance
Comparing Footnotes
|
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Merge activity
|
## Summary - Split the `eslint/no-useless-call` fast path out from #23829 for easier review and bisectability. - Add a direct static-member callee classifier for `foo.call(...)` / `foo.apply(...)`, so common non-`.call` / non-`.apply` static calls return before the generic member-expression fallback. - Keep the fallback for parenthesized, chained, computed, and optional-chain cases, with parenthesized regression coverage. Credit to Yagiz Nizipli for the original work in #23829. Co-authored-by: Yagiz Nizipli <yagiz@nizipli.com>
6e7b8ff to
fdbd34d
Compare
## Summary - Split the `eslint/no-useless-call` fast path out from #23829 for easier review and bisectability. - Add a direct static-member callee classifier for `foo.call(...)` / `foo.apply(...)`, so common non-`.call` / non-`.apply` static calls return before the generic member-expression fallback. - Keep the fallback for parenthesized, chained, computed, and optional-chain cases, with parenthesized regression coverage. Credit to Yagiz Nizipli for the original work in #23829. Co-authored-by: Yagiz Nizipli <yagiz@nizipli.com>
## Summary - Split the `eslint/no-useless-call` fast path out from #23829 for easier review and bisectability. - Add a direct static-member callee classifier for `foo.call(...)` / `foo.apply(...)`, so common non-`.call` / non-`.apply` static calls return before the generic member-expression fallback. - Keep the fallback for parenthesized, chained, computed, and optional-chain cases, with parenthesized regression coverage. Credit to Yagiz Nizipli for the original work in #23829. Co-authored-by: Yagiz Nizipli <yagiz@nizipli.com>
Summary
eslint/no-useless-callfast path out from perf(linter): speed up hot rules on large codebases #23829 for easier review and bisectability.foo.call(...)/foo.apply(...), so common non-.call/ non-.applystatic calls return before the generic member-expression fallback.Credit to Yagiz Nizipli for the original work in #23829.
Co-authored-by: Yagiz Nizipli yagiz@nizipli.com