diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2016-05-12 11:37:08 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2016-05-18 10:11:36 -0400 |
| commit | e4c31de61ec1e59c802c67cc62e9a4a164127e7c (patch) | |
| tree | c2bf18ed8d0d5fcaaa46e82e8c6b90ca78a87f67 | |
| parent | c9810013895914d29b06ba2fa720296035998f35 (diff) | |
| download | rust-e4c31de61ec1e59c802c67cc62e9a4a164127e7c.tar.gz rust-e4c31de61ec1e59c802c67cc62e9a4a164127e7c.zip | |
nit: cache crate-hash for next time
| -rw-r--r-- | src/librustc_incremental/persist/hash.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/librustc_incremental/persist/hash.rs b/src/librustc_incremental/persist/hash.rs index c36b9ed0d26..b729f25b873 100644 --- a/src/librustc_incremental/persist/hash.rs +++ b/src/librustc_incremental/persist/hash.rs @@ -86,6 +86,11 @@ impl<'a, 'tcx> HashContext<'a, 'tcx> { // krate; in that case, we just use the krate's overall hash if let Some(&hash) = self.crate_hashes.get(&def_id.krate) { debug!("metadata_hash: def_id={:?} crate_hash={:?}", def_id, hash); + + // micro-"optimization": avoid a cache miss if we ask + // for metadata from this particular def-id again. + self.item_metadata_hashes.insert(def_id, hash.as_u64()); + return hash.as_u64(); } |
