You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Major regression in type checking performance compiling rustdoc #21694
A partial log of RUSTFLAGS="-Z time-passes" make x86_64-unknown-linux-gnu/stage2/bin/rustdoc, after doing a fresh rebuild on d77f6d5366b330f9c2061cad0d3ff638c9cc05b7:
I did a bunch more profiling. First off, normalisation and projection barely showed up in the profile, so I think #20304 is a red herring.
Substs interning did, but because it was called a huge number of times, it's not that expensive for each call. I tried disabling interning, for rustdoc this led to OOMs. For libcore which also has a very high type checking time (relative to other phases) this only reduced type checking time by 6%, so I predict it won't be helpful in the rustdoc case.
The majority of the time is coming from trait selection - SelectionContext::evalute_predicate_recursively is the overarching method in the profile. Winnowing in particular is taking ~75% of the time.
So, I don't think caching normalisation and projection is worthwhile, at least here, it might be for other reasons. I need to look a bit closer at the code around selections. AIUI, only first phase is cached and I don't think winnowing is. I wonder if we could cache that too? I also want to check that caching is working as expected and we're not missing where we should hit.
Activity
nikomatsakis commentedon Jan 27, 2015
Nominating. We should track this down. Quite possibly due to #20304
nrc commentedon Jan 27, 2015
cc me
nrc commentedon Jan 29, 2015
I've been profiling this and the most time was spent in the hash function for
Substs. Which is kind of weird.nikomatsakis commentedon Jan 29, 2015
interesting, could be related to @huonw's changes to intern
Substspnkfelix commentedon Jan 29, 2015
Polish issue, but worth trying to address by 1.0 beta.
nikomatsakis commentedon Jan 29, 2015
but it's always possible that it's just that we're doing a lot more hashing -- i.e., it's the caller's problem
jdm commentedon Jan 30, 2015
cc me
nrc commentedon Jan 30, 2015
I did a bunch more profiling. First off, normalisation and projection barely showed up in the profile, so I think #20304 is a red herring.
Substs interning did, but because it was called a huge number of times, it's not that expensive for each call. I tried disabling interning, for rustdoc this led to OOMs. For libcore which also has a very high type checking time (relative to other phases) this only reduced type checking time by 6%, so I predict it won't be helpful in the rustdoc case.
The majority of the time is coming from trait selection -
SelectionContext::evalute_predicate_recursivelyis the overarching method in the profile. Winnowing in particular is taking ~75% of the time.So, I don't think caching normalisation and projection is worthwhile, at least here, it might be for other reasons. I need to look a bit closer at the code around selections. AIUI, only first phase is cached and I don't think winnowing is. I wonder if we could cache that too? I also want to check that caching is working as expected and we're not missing where we should hit.
sanxiyn commentedon Feb 2, 2015
FYI, slowness is caused by trying to infer and check an excessive use of iterator chain.
nikomatsakis commentedon Feb 2, 2015
Interesting. That fits with @nick29581's profiles, for sure.
nikomatsakis commentedon Feb 2, 2015
we should make a standalone test case...
huonw commentedon Feb 2, 2015
It seems to be related to the equality constraint between the associated types:
(The blow-up appears to be exponential.)
nrc commentedon Feb 12, 2015
Closing this - the rustdoc-specific perf issue has been fixed in #21864. I have opened #22204 for the general case.
Merge pull request rust-lang#21694 from rust-lang/rustc-pull