diff options
| author | bors <bors@rust-lang.org> | 2024-11-19 02:07:48 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-11-19 02:07:48 +0000 |
| commit | 5926e82dd1eae211c6e2ffe446de54df04798e89 (patch) | |
| tree | 215bd11859c5457e0984595fd48e6c7a1e9877c2 /compiler/rustc_middle/src/query | |
| parent | b71fb5edc0217eaf8fc824a44cd7b0945e29ff4d (diff) | |
| parent | da58efb11df229eac6eb727c2884546310f9ffde (diff) | |
Auto merge of #124780 - Mark-Simulacrum:lockless-cache, r=lcnr
Improve VecCache under parallel frontend This replaces the single Vec allocation with a series of progressively larger buckets. With the cfg for parallel enabled but with -Zthreads=1, this looks like a slight regression in i-count and cycle counts (~1%). With the parallel frontend at -Zthreads=4, this is an improvement (-5% wall-time from 5.788 to 5.4688 on libcore) than our current Lock-based approach, likely due to reducing the bouncing of the cache line holding the lock. At -Zthreads=32 it's a huge improvement (-46%: 8.829 -> 4.7319 seconds). try-job: i686-gnu-nopt try-job: dist-x86_64-linux
Diffstat (limited to 'compiler/rustc_middle/src/query')
| -rw-r--r-- | compiler/rustc_middle/src/query/keys.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_middle/src/query/keys.rs b/compiler/rustc_middle/src/query/keys.rs index 9cb11cdd3b7..d2fab8e78d5 100644 --- a/compiler/rustc_middle/src/query/keys.rs +++ b/compiler/rustc_middle/src/query/keys.rs @@ -2,6 +2,7 @@ use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE, LocalDefId, LocalModDefId, ModDefId}; use rustc_hir::hir_id::{HirId, OwnerId}; +use rustc_query_system::dep_graph::DepNodeIndex; use rustc_query_system::query::{DefIdCache, DefaultCache, SingleCache, VecCache}; use rustc_span::symbol::{Ident, Symbol}; use rustc_span::{DUMMY_SP, Span}; @@ -111,7 +112,7 @@ impl<'tcx> Key for mir::interpret::LitToConstInput<'tcx> { } impl Key for CrateNum { - type Cache<V> = VecCache<Self, V>; + type Cache<V> = VecCache<Self, V, DepNodeIndex>; fn default_span(&self, _: TyCtxt<'_>) -> Span { DUMMY_SP @@ -128,7 +129,7 @@ impl AsLocalKey for CrateNum { } impl Key for OwnerId { - type Cache<V> = VecCache<Self, V>; + type Cache<V> = VecCache<Self, V, DepNodeIndex>; fn default_span(&self, tcx: TyCtxt<'_>) -> Span { self.to_def_id().default_span(tcx) @@ -140,7 +141,7 @@ impl Key for OwnerId { } impl Key for LocalDefId { - type Cache<V> = VecCache<Self, V>; + type Cache<V> = VecCache<Self, V, DepNodeIndex>; fn default_span(&self, tcx: TyCtxt<'_>) -> Span { self.to_def_id().default_span(tcx) |
