-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Slow compilation with extremely borrowed type #103195
Comments
rust/compiler/rustc_data_structures/src/transitive_relation.rs Lines 98 to 105 in a24a020
Specifically, the
And indeed, the |
Doubling the amount of nested references makes it go up to |
@SparrowLii since you've recently touched that code |
Use Set instead of Vec in transitive_relation Helps with rust-lang#103195. It doesn't fix the underlying quadraticness but it makes it _a lot_ faster to an extent where even doubling the amount of nested references still takes less than two seconds (50s on nightly). I want to see whether this causes regressions (because the vec was usually quite small) or improvements (as lookup for bigger sets is now much faster) in real code.
This is now fixed, meaning the slowness is gone and it's reasonably fast now. I'm not sure whether we want to keep the issue though, as there seems to be some quadraticness in borrowck that caused this - using a better datastructure helped mitigate it, but the quadraticness is still there - whether it matters is another question. |
@Nilstrieb if this is fixed, then I'll probably close this. If we're tracking other quadraticness in the borrow checker, then we should both have examples that trigger such quadraticness and also open separate issues, since their fixes will likely be similar but distinct. |
Use Set instead of Vec in transitive_relation Helps with rust-lang#103195. It doesn't fix the underlying quadraticness but it makes it _a lot_ faster to an extent where even doubling the amount of nested references still takes less than two seconds (50s on nightly). I want to see whether this causes regressions (because the vec was usually quite small) or improvements (as lookup for bigger sets is now much faster) in real code.
This fairly small Rust program takes 5–10 seconds to compile (playground):
Found with fuzz-rustc.
Timings
The passes taking the most time are:
Output with `-Z time-passes`
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: