Uh oh!
There was an error while loading. Please reload this page.
Merge CrateDisambiguator into StableCrateId - #85804
Conversation
rust-highfive
commented
May 29, 2021
(rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
2eaeaff to
2a2d4afCompare
This comment has been minimized.
This comment has been minimized.
bjorn3
commented
May 29, 2021
@bors try @rust-timer queue |
rust-timer
commented
May 29, 2021
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
bors
commented
May 29, 2021
⌛ Trying commit 195e4a24be951480d9d27bd44a0f30771e374ae3 with merge 621a481ceedc7341caa1c2cdb9f083e0a2d47de4... |
This comment has been minimized.
This comment has been minimized.
bors
commented
May 29, 2021
☀️ Try build successful - checks-actions |
rust-timer
commented
May 29, 2021
Queued 621a481ceedc7341caa1c2cdb9f083e0a2d47de4 with parent f77b1a5, future comparison URL. |
rust-timer
commented
May 29, 2021
Finished benchmarking try commit (621a481ceedc7341caa1c2cdb9f083e0a2d47de4): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
bjorn3
commented
May 29, 2021
Overall this seems to be a slight perf improvement. I would guess that the regressions are caused by the fact that the |
195e4a2 to
d7408a7Compare
This comment has been minimized.
This comment has been minimized.
d7408a7 to
329187fCompare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
56ac1c2 to
576488eComparebors
commented
May 29, 2021
☔ The latest upstream changes (presumably #85698) made this pull request unmergeable. Please resolve the merge conflicts. |
bors
commented
May 30, 2021
bors
commented
May 30, 2021
☀️ Test successful - checks-actions |
ehuss
commented
May 30, 2021
Would you mind updating the rustc-dev-guide to accommodate this change? https://rustc-dev-guide.rust-lang.org/backend/libs-and-metadata.html#crate-disambiguator Also, this seems to drop the hash size from 128 bits to 64 bits, but I don't see any discussion here if that might cause any problems? |
Sure Edit: rust-lang/rustc-dev-guide#1135
It was already impossible to have two crates with different disambiguators but identical |
ehuss
commented
May 30, 2021
Thanks I appreciate it! |
Mark-Simulacrum
commented
Jun 1, 2021
@bjorn3 It seems like this was a regression on landing - https://perf.rust-lang.org/compare.html?start=2023cc3aa1ea98530f3124ed07713e6f95fd26ab&end=59579907ab52ad2369735622185a26f158bf0f0f&stat=instructions%3Au . This seems held up by further perf runs over the course of the week, too, so likely not spurious. I think we should measure a revert PR, at the very least; would you be up for posting that? |
bjorn3
commented
Jun 1, 2021
Strange. The previous perf run showed that it was an improvement.
Done: #85891 |
| pub struct StableCrateId(u64); | ||
| impl StableCrateId { | ||
| pub fn to_u64(self) -> u64 { |
There was a problem hiding this comment.
I forgot to mark this as #[inline]. Maybe that is responsible for the perf regression?
| pub fn generate_proc_macro_decls_symbol(&self, disambiguator: CrateDisambiguator) -> String { | ||
| format!("__rustc_proc_macro_decls_{}__", disambiguator.to_fingerprint().to_hex()) | ||
| pub fn generate_proc_macro_decls_symbol(&self, stable_crate_id: StableCrateId) -> String { | ||
| format!("__rustc_proc_macro_decls_{:08x}__", stable_crate_id.to_u64()) |
There was a problem hiding this comment.
Using {:08x} instead of {:x} like to_hex() seems to have used may also be part of the problem.
| let crate_name = tcx.original_crate_name(cnum).to_string(); | ||
| let crate_disambiguator = tcx.crate_disambiguator(cnum); | ||
| ((crate_name, crate_disambiguator), cnum) | ||
| let stable_crate_id = tcx.def_path_hash(cnum.as_def_id()).stable_crate_id(); |
There was a problem hiding this comment.
Avoiding the def_path_hash call here in favor of directly looking up the StableCrateId by CrateNum from the CStore may also help.
…or, r=Mark-Simulacrum Revert "Merge CrateDisambiguator into StableCrateId" This reverts rust-lang#85804
…mbiguator, r=michaelwoerister Reland "Merge CrateDisambiguator into StableCrateId" Reverts rust-lang#85891 as this revert of rust-lang#85804 made perf even worse. r? `@Mark-Simulacrum`
This simplifies the code and potentially improves performance by reducing the amount of hashed data.
Fixes#85795