Use UnhashMap for the index

This commit is contained in:
John Kåre Alsaker 2023-09-12 08:59:37 +02:00
parent 734e5a1fbd
commit f8ad88be81

View File

@ -43,6 +43,7 @@
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::profiling::SelfProfilerRef;
use rustc_data_structures::sync::Lock;
use rustc_data_structures::unhash::UnhashMap;
use rustc_index::{Idx, IndexVec};
use rustc_serialize::opaque::{FileEncodeResult, FileEncoder, IntEncodedWithFixedSize, MemDecoder};
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
@ -84,7 +85,7 @@ pub struct SerializedDepGraph<K: DepKind> {
edge_list_data: Vec<u8>,
/// Stores a map from fingerprints to nodes per dep node kind.
/// This is the reciprocal of `nodes`.
index: Vec<FxHashMap<PackedFingerprint, SerializedDepNodeIndex>>,
index: Vec<UnhashMap<PackedFingerprint, SerializedDepNodeIndex>>,
}
impl<K: DepKind> Default for SerializedDepGraph<K> {
@ -256,7 +257,7 @@ fn decode(d: &mut MemDecoder<'a>) -> SerializedDepGraph<K> {
// Read the number of each dep kind and use it to create an hash map with a suitable size.
let mut index: Vec<_> = (0..(K::MAX as usize + 1))
.map(|_| FxHashMap::with_capacity_and_hasher(d.read_u32() as usize, Default::default()))
.map(|_| UnhashMap::with_capacity_and_hasher(d.read_u32() as usize, Default::default()))
.collect();
for (idx, node) in nodes.iter_enumerated() {