Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc 4x compilation time slowdown in rust 1.55 #88998

Closed
bazald opened this issue Sep 16, 2021 · 6 comments
Closed

rustc 4x compilation time slowdown in rust 1.55 #88998

bazald opened this issue Sep 16, 2021 · 6 comments
Labels
I-slow Issue: Problems and improvements with respect to performance of generated code. regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@bazald
Copy link

bazald commented Sep 16, 2021

Moving from rustc 1.54 to 1.55, I'm observing a 4x compilation time slowdown for the examples for the hash-trie crate I'm working on. permalink to current revision

I'm not sure if this is a bug, or some new compilation feature, but compilation times increasing from 45-60s to 180-240s is not something I was expecting.

cargo run --release --example set
cargo run --release --example set_xor

Perhaps I'm doing something pathological in my crate, but I'd be very curious to know what change is causing this.

@Mark-Simulacrum Mark-Simulacrum added I-slow Issue: Problems and improvements with respect to performance of generated code. regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 16, 2021
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Sep 16, 2021
@jyn514
Copy link
Member

jyn514 commented Sep 16, 2021

@bazald does this only happen with --release or does cargo build also reproduce the issue? Can you run cargo rustc --release --example set -Z time-passes and post the output? (-Z self-profile would also be helpful, it will generate a profdata file you can upload.)

@bazald
Copy link
Author

bazald commented Sep 16, 2021

@jyn514 I can say that non-release build times seem marginally slower, but nothing I'd have noticed without the --release issue. Definitely appears that some optimization is going haywire on this code in 1.55... or is very expensive.

Regarding your other requests, I'm afraid I get the following message:

error: the `-Z` flag is only accepted on the nightly channel of Cargo, but this is the `stable` channel
See https://doc.rust-lang.org/book/appendix-07-nightly-rust.html for more information about Rust release channels.

This sent me down a rabbit hole. Which nightlies are roughly equivalent? Can I even install old nightlies? If I can do that, can I basically run a bisect? Turns out I can.

nightly-2021-07-05-x86_64-pc-windows-msvc gives the old compilation time. (59.93s including dependencies)
nightly-2021-07-06-x86_64-pc-windows-msvc gives the new, drastically slowed compilation time. (3m 03s including dependencies)

I'm not sure I have the energy to run more commands tonight. Can you clarify whether you want -Z time-passes and -Z self-profile separately, and whether you want them for both 2021-07-05 and 2021-07-06 or just 06?

@hkratz
Copy link
Contributor

hkratz commented Sep 16, 2021

Some findings on a Mac M1:

  • cargo clean; cargo +1.54.0 build --release --example set # 17.24s
  • cargo clean; cargo +1.55.0 build --example set # 4.75s
  • cargo clean; cargo +1.55.0 build --release --example set # 57.07s
  • cargo clean; cargo +beta build --release --example set # (1.56.0-beta.2) - 16.44s
  • cargo clean; cargo +nightly build --release --example set # (2021-09-15) - 16.61s

So only with 1.55.0 and --release, fixed in 1.56 beta and nightly.

@hkratz
Copy link
Contributor

hkratz commented Sep 16, 2021

 Regression bisection led to #84560 (!), fix bisection lead to the update to LLVM 13 (#87570).

@jyn514
Copy link
Member

jyn514 commented Sep 16, 2021

cc @nikic

@jyn514
Copy link
Member

jyn514 commented Sep 16, 2021

Oh wait, I misread - this is only an issue with two releases of the rust compiler? I'm going to close this then since it's fixed on nightly.

@jyn514 jyn514 closed this as completed Sep 16, 2021
@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Sep 16, 2021
@jyn514 jyn514 changed the title rustc 4x compilation time slowdown rustc 4x compilation time slowdown in rust 1 Sep 16, 2021
@jyn514 jyn514 changed the title rustc 4x compilation time slowdown in rust 1 rustc 4x compilation time slowdown in rust 1.55 Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-slow Issue: Problems and improvements with respect to performance of generated code. regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants