-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Closed
Labels
A-incr-compArea: Incremental compilationArea: Incremental compilationC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Existing fingerprint values can be merged into one fingerprint via the rather efficient Fingerprint::combine() method. We should make use of that during SVH computation instead of re-hashing all those fingerprints.
See here:
rust/src/librustc/hir/map/collector.rs
Lines 123 to 163 in 2e33c89
| pub(super) fn finalize_and_compute_crate_hash(self, | |
| crate_disambiguator: CrateDisambiguator, | |
| cstore: &CrateStore, | |
| commandline_args_hash: u64) | |
| -> (Vec<MapEntry<'hir>>, Svh) { | |
| let mut node_hashes: Vec<_> = self | |
| .hir_body_nodes | |
| .iter() | |
| .map(|&(def_path_hash, dep_node_index)| { | |
| (def_path_hash, self.dep_graph.fingerprint_of(dep_node_index)) | |
| }) | |
| .collect(); | |
| node_hashes.sort_unstable_by(|&(ref d1, _), &(ref d2, _)| d1.cmp(d2)); | |
| let mut upstream_crates: Vec<_> = cstore.crates_untracked().iter().map(|&cnum| { | |
| let name = cstore.crate_name_untracked(cnum).as_str(); | |
| let disambiguator = cstore.crate_disambiguator_untracked(cnum) | |
| .to_fingerprint(); | |
| let hash = cstore.crate_hash_untracked(cnum); | |
| (name, disambiguator, hash) | |
| }).collect(); | |
| upstream_crates.sort_unstable_by(|&(name1, dis1, _), &(name2, dis2, _)| { | |
| (name1, dis1).cmp(&(name2, dis2)) | |
| }); | |
| let (_, crate_dep_node_index) = self | |
| .dep_graph | |
| .with_task(DepNode::new_no_params(DepKind::Krate), | |
| &self.hcx, | |
| ((node_hashes, upstream_crates), | |
| (commandline_args_hash, | |
| crate_disambiguator.to_fingerprint())), | |
| identity_fn); | |
| let svh = Svh::new(self.dep_graph | |
| .fingerprint_of(crate_dep_node_index) | |
| .to_smaller_hash()); | |
| (self.map, svh) | |
| } |
Metadata
Metadata
Assignees
Labels
A-incr-compArea: Incremental compilationArea: Incremental compilationC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.