Cache local DefId-keyed queries without hashing
Foreign maps are used to cache external DefIds, typically backed by metadata decoding. In the future we might skip caching `V` there (since loading from metadata usually is already cheap enough), but for now this cuts down on the impact to memory usage and time to None-init a bunch of memory. Foreign data is usually much sparser, since we're not usually loading *all* entries from the foreign crate(s).
This commit is contained in:
parent
665d2c6f2c
commit
37849643c6
3 changed files with 82 additions and 3 deletions
|
@ -9,6 +9,7 @@ use crate::ty::{self, Ty, TyCtxt};
|
|||
use crate::ty::{GenericArg, GenericArgsRef};
|
||||
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LocalModDefId, ModDefId, LOCAL_CRATE};
|
||||
use rustc_hir::hir_id::{HirId, OwnerId};
|
||||
use rustc_query_system::query::DefIdCacheSelector;
|
||||
use rustc_query_system::query::{DefaultCacheSelector, SingleCacheSelector, VecCacheSelector};
|
||||
use rustc_span::symbol::{Ident, Symbol};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
@ -152,7 +153,7 @@ impl Key for LocalDefId {
|
|||
}
|
||||
|
||||
impl Key for DefId {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
type CacheSelector = DefIdCacheSelector;
|
||||
|
||||
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
tcx.def_span(*self)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue