Commit f81ba2b
committed
Auto merge of #57546 - dotdash:match, r=<try>
Avoid layout calculations in assert_bits to speed up match checking
assert_bits ensures that the given type matches the type of the constant
value, and additionally performs a query for the layout of the given
type to get its size. This is then used to assert that it matches the
size of the constant. But since the types are already known to be the
same, this second check is unnecessary, and skipping it also allows to
skip the expensive layout query.
For the unicode_normalization crate, the match checking time drops from
about 3.8s to about 0.8s for me.
Ref #55528
cc unicode-rs/unicode-normalization#29File tree
5 files changed
+16
-21
lines changed- src
- librustc_mir
- build/matches
- hair/pattern
- transform
- librustc/ty
5 files changed
+16
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2278 | 2278 | | |
2279 | 2279 | | |
2280 | 2280 | | |
2281 | | - | |
| 2281 | + | |
2282 | 2282 | | |
2283 | 2283 | | |
2284 | 2284 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2152 | 2152 | | |
2153 | 2153 | | |
2154 | 2154 | | |
2155 | | - | |
2156 | | - | |
2157 | | - | |
2158 | | - | |
2159 | | - | |
| 2155 | + | |
2160 | 2156 | | |
2161 | | - | |
2162 | | - | |
2163 | | - | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
2164 | 2163 | | |
2165 | 2164 | | |
2166 | 2165 | | |
2167 | 2166 | | |
2168 | | - | |
| 2167 | + | |
2169 | 2168 | | |
2170 | 2169 | | |
2171 | 2170 | | |
| |||
2174 | 2173 | | |
2175 | 2174 | | |
2176 | 2175 | | |
2177 | | - | |
| 2176 | + | |
2178 | 2177 | | |
2179 | 2178 | | |
2180 | 2179 | | |
2181 | | - | |
2182 | | - | |
2183 | | - | |
2184 | | - | |
2185 | | - | |
2186 | | - | |
| 2180 | + | |
| 2181 | + | |
2187 | 2182 | | |
2188 | 2183 | | |
2189 | 2184 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
| 117 | + | |
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
844 | 844 | | |
845 | 845 | | |
846 | 846 | | |
847 | | - | |
| 847 | + | |
848 | 848 | | |
849 | 849 | | |
850 | 850 | | |
| |||
1458 | 1458 | | |
1459 | 1459 | | |
1460 | 1460 | | |
1461 | | - | |
| 1461 | + | |
1462 | 1462 | | |
1463 | 1463 | | |
1464 | 1464 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
0 commit comments