Specialize DefPathHash table to skip crate IDs
Instead, we store just the local crate hash as a bare u64. On decoding, we recombine it with the crate's stable crate ID stored separately in metadata. The end result is that we save ~8 bytes/DefIndex in metadata size. One key detail here is that we no longer distinguish in encoded metadata between present and non-present DefPathHashes. It used to be highly likely we could distinguish as we used DefPathHash::default(), an all-zero representation. However in theory even that is fallible as nothing strictly prevents the StableCrateId from being zero.
This commit is contained in:
parent
edcbcc768a
commit
6630d69085
5 changed files with 19 additions and 31 deletions
|
@ -114,8 +114,6 @@ impl DefPathHash {
|
|||
}
|
||||
|
||||
/// Returns the crate-local part of the [DefPathHash].
|
||||
///
|
||||
/// Used for tests.
|
||||
#[inline]
|
||||
pub fn local_hash(&self) -> Hash64 {
|
||||
self.0.split().1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue