Commit d5002fa
committed
Auto merge of #279 - Zoxc:find-opt, r=Amanieu
Optimize `find`
This optimizes `find` for size and performance.
The `cargo llvm-lines` output from the following program is reduced from 15837 to 15771.
```rust
fn main() {
let mut map1 = hashbrown::HashMap::new();
map1.insert(1u8, "");
map1.reserve(1000);
dbg!(map1.get(&1));
let mut map2 = hashbrown::HashMap::new();
map2.insert(1i16, "");
map2.reserve(1000);
dbg!(map2.get(&1));
let mut map3 = hashbrown::HashMap::new();
map3.insert(3u16, "");
map3.reserve(1000);
dbg!(map3.get(&1));
let mut map4 = hashbrown::HashMap::new();
map4.insert(3u64, "");
map4.reserve(1000);
dbg!(map4.get(&1));
dbg!((
map1.iter().next(),
map2.iter().next(),
map3.iter().next(),
map4.iter().next()
));
}
```
`rustc_driver` size (with optimizations) is reduced by 0.14%.
Impact on compiler performance:
```
clap:check 1.9602s 1.9407s -0.99%
helloworld:check 0.0420s 0.0420s +0.06%
hyper:check 0.2977s 0.2968s -0.30%
regex:check 1.1573s 1.1475s -0.85%
syn:check 1.6993s 1.6870s -0.73%
syntex_syntax:check 6.8989s 6.8263s -1.05%
winapi:check 8.4423s 8.3300s -1.33%
Total 20.4977s 20.2702s -1.11%
Summary 3.5000s 3.4740s -0.74%
```1 file changed
+37
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
921 | 921 | | |
922 | 922 | | |
923 | 923 | | |
924 | | - | |
925 | | - | |
926 | | - | |
927 | | - | |
928 | | - | |
929 | | - | |
930 | | - | |
931 | | - | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
932 | 932 | | |
933 | 933 | | |
934 | 934 | | |
| |||
1054 | 1054 | | |
1055 | 1055 | | |
1056 | 1056 | | |
| 1057 | + | |
1057 | 1058 | | |
1058 | 1059 | | |
1059 | 1060 | | |
| |||
1255 | 1256 | | |
1256 | 1257 | | |
1257 | 1258 | | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
1258 | 1285 | | |
1259 | 1286 | | |
1260 | 1287 | | |
| |||
2187 | 2214 | | |
2188 | 2215 | | |
2189 | 2216 | | |
| 2217 | + | |
2190 | 2218 | | |
2191 | 2219 | | |
2192 | 2220 | | |
| |||
2196 | 2224 | | |
2197 | 2225 | | |
2198 | 2226 | | |
| 2227 | + | |
2199 | 2228 | | |
2200 | 2229 | | |
2201 | 2230 | | |
| |||
0 commit comments