Compile slow down against trait bound of nested structs #83341
Labels
A-trait-system
Area: Trait system
I-compiletime
Issue: Problems and improvements with respect to compile times.
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.
I'm not sure if this should be reported as a regression. I found compiling my code with Rust 1.41.0 took triple time compared to the previous version. It occurred 1 year ago and filed at my repo, so this is a bit old issue.
The code contains nested structs with trait bounds. It took some time to compile in the previous version too. I guess compiling this code take exponential time even in older versions of rust compiler because when I add a pass to the chain, compile time increases under certain multiplier. The issue is the multiplier increased in Rust 1.41.0.
Here is some brief measures:
Compiling slowed down in 1.41.0. Though there are some improvements in the latest versions, it is still slow.
Here is flamegraph of rust compiler against compiling the code:
I
git bisect
ed and found the problem is introduced in this PR: #66408Code
I tried this code:
I expected to see this happen: compiles in < 30s
Instead, this happened: compiles in > 60s
Version it worked on
It most recently worked on: 1.40.0
Version with regression
rustc --version --verbose
:Backtrace
Backtrace
The text was updated successfully, but these errors were encountered: