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

analysis-stats perf regression #6362

Closed
jonas-schievink opened this issue Oct 26, 2020 · 7 comments
Closed

analysis-stats perf regression #6362

jonas-schievink opened this issue Oct 26, 2020 · 7 comments

Comments

@jonas-schievink
Copy link
Contributor

stats-perf

Looks like the cause is somewhere in the range e315fd...43253c. Unfortunately it's very noisy, so it might be caused by something that is slightly outside of that range.

@lnicola
Copy link
Member

lnicola commented Oct 26, 2020

Since ripgrep and webrender don't show any change, it might be that rust-analyzer itself just got harder to analyze. But there doesn't seem to be a large code or complexity increase in that range.

@jonas-schievink
Copy link
Contributor Author

Oh, it's the additional fmt::Debug bounds here: https://github.com/rust-analyzer/rust-analyzer/pull/6094/files#diff-5e1b9043a18996b86f83bba7836c3b97ab88cf3c4834850c62de4f435e483318R26

I actually saw chalk spending a long time proving Debug bounds and mentioned that on Zulip: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Poor.20type.20inference.20performance.20on.20chained.20method.20calls

So, seems like a chalk bug.

@flodiebold
Copy link
Member

Oh yeah, the problem is that currently Chalk doesn't normalize the associated type projection before trying to prove the bound, which means it has to go through every impl. So with a trait that has a lot of impls like Debug, that can be a big performance problem. rust-lang/chalk#589 should address that, but it's been a long time coming.

@jonas-schievink
Copy link
Contributor Author

Ah, okay. That explains why it's still fast in general, if proving ConcreteType: Debug doesn't hvae to go through all impls.

@nightkr
Copy link

nightkr commented Oct 30, 2020

FWIW I've had a regression somewhere between 2edf15a...cb78c40 that makes rust-analyzer nearly unusable (auto-completion takes seconds to show up after I start typing, and when I'm done it slowly chugs through my edits character by character to re-highlight errors, spending about a second per edit) on my laptop (Ryzen 3750H, emacs + lsp-mode, Linux).

Weirdly enough my desktop seems to handle it fine (Ryzen 3900X, but otherwise similar).

It seems to happen for https://github.com/clux/kube-rs and to a lesser degree https://github.com/hyperium/hyper, but not an empty dummy project created by cargo new.

I'll try to see if it seems to match up with your tighter commit range..

@nightkr
Copy link

nightkr commented Oct 30, 2020

Reverting #6094 from master didn't seem to make a difference for me (and I had a pretty hard time believing it should make a difference for non-RA projects).

43253c5 also seems to still be on the good side for me, so I guess it's an unrelated issue.

@flodiebold
Copy link
Member

I opened an issue to keep track of the Chalk issue, but let's close this since it's otherwise not really actionable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants