diff options
| author | bors <bors@rust-lang.org> | 2023-08-24 02:24:25 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-08-24 02:24:25 +0000 |
| commit | 840ed5d133e7a46f37e1499074bfe4a72089c84b (patch) | |
| tree | 484b66d95762d04784ec2093bc98a0f04884b291 /compiler/rustc_query_system | |
| parent | c9db1f804bd324d8803afcb37028f1a0ef7b8992 (diff) | |
| parent | 0823f0c32b600dafcc707e76dc1898eadc3c2b59 (diff) | |
| download | rust-840ed5d133e7a46f37e1499074bfe4a72089c84b.tar.gz rust-840ed5d133e7a46f37e1499074bfe4a72089c84b.zip | |
Auto merge of #114860 - Zoxc:sharded-layout, r=SparrowLii
Make `Sharded` an enum and specialize it for the single thread case This changes `Sharded` to use a single shard by an enum, reducing the size of `Sharded` for greater cache efficiency. Performance improvement with 1 thread and `cfg(parallel_compiler)`: <table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th></tr><tr><td align="right">Time</td><td align="right">Time</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check</td><td align="right">1.7009s</td><td align="right">1.6748s</td><td align="right">💚 -1.53%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2525s</td><td align="right">0.2451s</td><td align="right">💚 -2.90%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">0.9519s</td><td align="right">0.9353s</td><td align="right">💚 -1.74%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.5504s</td><td align="right">1.5280s</td><td align="right">💚 -1.45%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">5.9536s</td><td align="right">5.8873s</td><td align="right">💚 -1.11%</td></tr><tr><td>Total</td><td align="right">10.4092s</td><td align="right">10.2706s</td><td align="right">💚 -1.33%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9825s</td><td align="right">💚 -1.75%</td></tr></table> I did see an unexpected 0.23% change for the serial compiler, so this could use a perf run to see if that reproduces. cc `@SparrowLii`
Diffstat (limited to 'compiler/rustc_query_system')
| -rw-r--r-- | compiler/rustc_query_system/src/dep_graph/graph.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_query_system/src/dep_graph/graph.rs b/compiler/rustc_query_system/src/dep_graph/graph.rs index 30422ea1102..0d4d13ac20d 100644 --- a/compiler/rustc_query_system/src/dep_graph/graph.rs +++ b/compiler/rustc_query_system/src/dep_graph/graph.rs @@ -1166,7 +1166,7 @@ impl<K: DepKind> CurrentDepGraph<K> { )), new_node_to_index: Sharded::new(|| { FxHashMap::with_capacity_and_hasher( - new_node_count_estimate / sharded::SHARDS, + new_node_count_estimate / sharded::shards(), Default::default(), ) }), |
