1
Fork 0

Auto merge of #94084 - Mark-Simulacrum:drop-sharded, r=cjgillot

Avoid query cache sharding code in single-threaded mode

In non-parallel compilers, this is just adding needless overhead at compilation time (since there is only one shard statically anyway). This amounts to roughly ~10 seconds reduction in bootstrap time, with overall neutral (some wins, some losses) performance results.

Parallel compiler performance should be largely unaffected by this PR; sharding is kept there.
This commit is contained in:
bors 2022-02-27 14:04:07 +00:00
commit 3b1fe7e7c9
8 changed files with 167 additions and 204 deletions

View file

@ -336,7 +336,7 @@ macro_rules! define_queries {
}
#[inline(always)]
fn query_cache<'a>(tcx: QueryCtxt<$tcx>) -> &'a QueryCacheStore<Self::Cache>
fn query_cache<'a>(tcx: QueryCtxt<$tcx>) -> &'a Self::Cache
where 'tcx:'a
{
&tcx.query_caches.$name
@ -537,12 +537,11 @@ macro_rules! define_queries_struct {
tcx: TyCtxt<$tcx>,
span: Span,
key: query_keys::$name<$tcx>,
lookup: QueryLookup,
mode: QueryMode,
) -> Option<query_stored::$name<$tcx>> {
opt_remap_env_constness!([$($modifiers)*][key]);
let qcx = QueryCtxt { tcx, queries: self };
get_query::<queries::$name<$tcx>, _>(qcx, span, key, lookup, mode)
get_query::<queries::$name<$tcx>, _>(qcx, span, key, mode)
})*
}
};