Commit a9f68b2
committed
perf(linter): move up rule retainment into initial collection to reduce allocation size (#14822)
In the current implementation, we collect all rules, and then remove rules that only run on specific node types and that have no relevant node types in the current file. This leads to a larger allocation size because we only remove the rules after we've already collected all of the rules.
This PR switches the order so that we filter out the rules before we actually collect them into a `Vec`. The downside of this is I can't see an easy way currently to make this work with the debug assertions we have for ensuring the runtime optimizations don't affect the output. The benefit of this is that the constant overhead for small files is much less, as shown by the benchmarks.1 parent e41dee5 commit a9f68b2
1 file changed
+19
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
| 177 | + | |
177 | 178 | | |
178 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
179 | 195 | | |
180 | 196 | | |
181 | 197 | | |
182 | | - | |
183 | | - | |
184 | 198 | | |
185 | 199 | | |
186 | 200 | | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
| 201 | + | |
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| |||
0 commit comments