Commit f6a9687
committed
perf(linter): store rules by AST type in a boxed array (#13578)
Follow-on after #13138.
`rules_by_ast_type` has a fixed length, known at compile time. So use a boxed array for it, instead of a `Vec`.
This has 2 advantages:
1. `Box<[Vec<T>; N]>` is 8 bytes, instead of 24 for `Vec<Vec<T>>`.
2. The length of the array is encoded in the type, so it may allow compiler to deduce that indexing into it with an `AstType` cannot go out of bounds, and remove bounds checks (maybe - if compiler is smart enough, it may already be able to deduce that with the `Vec`).1 parent ed77c31 commit f6a9687
1 file changed
+11
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
| 173 | + | |
172 | 174 | | |
173 | 175 | | |
174 | 176 | | |
175 | 177 | | |
176 | 178 | | |
177 | 179 | | |
178 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
179 | 189 | | |
180 | 190 | | |
181 | 191 | | |
| |||
0 commit comments