From b81f081e399d861a14ab58c891a396b6d1c1bc8a Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Mon, 8 Sep 2025 04:36:26 +0000 Subject: [PATCH] perf(linter): reduce indirection (#13574) Follow-on after #13138, as per [this comment](https://github.com/oxc-project/oxc/pull/13138#discussion_r2328531176). Previously `rules_by_ast_type` and `rules_any_ast_type` contained `&&RuleEnum`, which is unnecessary indirection. Store `&RuleEnum` instead. --- crates/oxc_linter/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/oxc_linter/src/lib.rs b/crates/oxc_linter/src/lib.rs index 46ffd170f4768..9e8cbe47fbb5c 100644 --- a/crates/oxc_linter/src/lib.rs +++ b/crates/oxc_linter/src/lib.rs @@ -181,6 +181,7 @@ impl Linter { let mut rules_any_ast_type = Vec::with_capacity(rules.len()); for (rule, ctx) in &rules { + let rule = *rule; // Collect node type information for rules. In large files, benchmarking showed it was worth // collecting rules into buckets by AST node type to avoid iterating over all rules for each node. if rule.should_run(&ctx_host) {