Skip to content

Commit

Permalink
nit: cache crate-hash for next time
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed May 18, 2016
1 parent c981001 commit e4c31de
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/librustc_incremental/persist/hash.rs
Expand Up @@ -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();
}

Expand Down

0 comments on commit e4c31de

Please sign in to comment.