Commit cf31c84
perf(linter): reduce bulk-suppression overhead in concurrent path
Two targeted changes to the bulk-suppression machinery introduced in
#19328 (oxlint-suppressions.json support).
**Change 1 — Eliminate the startup clone in `concurrent_map()`**
`SuppressionManager::concurrent_map()` previously constructed a
`papaya::HashMap` by iterating the suppression file and cloning every
key and value into it. Workers only ever *read* one entry per file, so
the copy was pure overhead: ~10–15 ms sequential startup cost for 10k
files / 20k suppressions.
Fix: wrap `AllSuppressionsMap` in `Arc` at load time.
`concurrent_map()` now calls `Arc::clone()` (a reference-count bump),
making the hand-off to rayon workers zero-copy.
Side effect: the `papaya` dependency can be removed from the worker
path in `service/runtime.rs`; `papaya::HashMap::pin()` is replaced by
a plain `FxHashMap::get`. The `&SuppressionFile::new(…)` dangling-
reference pattern is also fixed while touching that code.
**Change 2 — Reduce per-message `RuleName` allocations**
`build_suppression_map` called `message.into()` twice per message (once
for `get_mut`, once for `insert`). Replaced with `.entry().or_insert()`
so the key is computed once.
The filter closure in `suppress_lint_diagnostics` also called
`message.into()` twice per message (two separate `.get()` calls).
Replaced with `let key = RuleName::from(message)` so both lookups share
one allocation.
Net result: 1–2 heap allocations per message instead of 3–4.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>1 parent 99b850c commit cf31c84
File tree
3 files changed
+58
-72
lines changed- crates/oxc_linter/src
- service
- suppression
3 files changed
+58
-72
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
653 | 653 | | |
654 | 654 | | |
655 | 655 | | |
656 | | - | |
657 | | - | |
658 | | - | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | | - | |
668 | | - | |
669 | | - | |
670 | | - | |
671 | | - | |
672 | | - | |
673 | | - | |
674 | | - | |
675 | | - | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
676 | 668 | | |
677 | 669 | | |
678 | 670 | | |
| |||
716 | 708 | | |
717 | 709 | | |
718 | 710 | | |
719 | | - | |
| 711 | + | |
720 | 712 | | |
721 | 713 | | |
722 | 714 | | |
723 | 715 | | |
724 | 716 | | |
725 | 717 | | |
726 | 718 | | |
727 | | - | |
| 719 | + | |
728 | 720 | | |
729 | 721 | | |
730 | 722 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 15 | + | |
20 | 16 | | |
21 | 17 | | |
22 | 18 | | |
| |||
95 | 91 | | |
96 | 92 | | |
97 | 93 | | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
118 | 98 | | |
119 | 99 | | |
120 | 100 | | |
| |||
228 | 208 | | |
229 | 209 | | |
230 | 210 | | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
236 | 215 | | |
237 | | - | |
238 | 216 | | |
239 | 217 | | |
240 | 218 | | |
| |||
255 | 233 | | |
256 | 234 | | |
257 | 235 | | |
258 | | - | |
| 236 | + | |
| 237 | + | |
259 | 238 | | |
260 | 239 | | |
261 | | - | |
262 | | - | |
263 | | - | |
| 240 | + | |
264 | 241 | | |
265 | 242 | | |
266 | | - | |
267 | 243 | | |
268 | 244 | | |
269 | 245 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
68 | 82 | | |
69 | 83 | | |
70 | 84 | | |
71 | 85 | | |
72 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
73 | 91 | | |
74 | 92 | | |
75 | 93 | | |
76 | 94 | | |
77 | 95 | | |
78 | | - | |
| 96 | + | |
79 | 97 | | |
80 | 98 | | |
81 | 99 | | |
| |||
120 | 138 | | |
121 | 139 | | |
122 | 140 | | |
| 141 | + | |
123 | 142 | | |
124 | 143 | | |
125 | 144 | | |
126 | | - | |
| 145 | + | |
127 | 146 | | |
128 | 147 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
133 | 151 | | |
134 | | - | |
| 152 | + | |
135 | 153 | | |
136 | 154 | | |
137 | 155 | | |
138 | | - | |
139 | | - | |
| 156 | + | |
| 157 | + | |
140 | 158 | | |
141 | 159 | | |
142 | 160 | | |
143 | | - | |
| 161 | + | |
144 | 162 | | |
145 | 163 | | |
146 | 164 | | |
| |||
0 commit comments