perf(linter/eslint/max-depth): derive node types #23896
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.41) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.41 · 207 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.319
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #23896"
general
weight: 0.35
connorshea
Run on VS Code before and after to compare call #s and also to ensure that the number of violations were identical (which they are). Generated with Claude Code, tested and reviewed by me.
This rule is the last rule (after the other open PR is also merged) in the Rust set that runs on every node in a given codebase. All other rules had less than 15.2M calls when run on the vscode codebase.
--debug=timingsdoesn't include type-aware rules, so I haven't looked at those at all, and I'm not sure we can limit AST Nodes like this for those rules anyway.What
eslint/max-depthmatched on AST kinds inside itsshould_counthelper rather than inline inrun, so the linter codegen couldn't derive aNODE_TYPESbitset and emittedNone. That placed the rule in theany_typebucket, dispatchingrunon every AST node.This restructures
runto lead with a narrowingmatch node.kind()that the codegen'sEarlyDivergeDetectorrecognizes, so codegen now emits a bitset of the 9 statement kinds the rule actually acts on.should_count/should_stopare unchanged, so theIfStatementparent-guard and ancestor-counting logic — and thus the rule's behavior — are identical.Results
Measured on 11,674 files with only this rule enabled:
| | Calls | Rule time |
|---|---|---|
| Before | 15,251,059 | 223.1 ms |
| After | 157,335 | 5.5 ms |
~97× fewer
runcalls, ~40× faster.Test plan
cargo test -p oxc_linter max_depthpasses (behavior unchanged)cargo lintgenregenerates the bitset; generated impl now carries the 9 node types🤖 Generated with Claude Code