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
x/tools/gopls: investigate possible slowdown caused by exclusive type checking #62493
Comments
@khanakia can you share the rest of that trace? It looks like you are only showing the first six lines, but there should be a lot more. Completion can take a while in very large packages, even in small codebases. |
I have uploaded the trace results here let me know if you need anything else https://github.com/khanakia/entgo_autocomplete_vscode_slow/blob/main/completion.Completion.txt |
Thanks. From that trace I can see that type-checking is actually fast: the slowest "forEachPackage" is 50ms. Therefore, it must simply be the completion logic that is slow, which can happen if it is formatting a very large number of results. I think we can improve this massively, by restricting the number of results and/or delaying the formatting of the completion item (using new LSP APIs). |
I see but vs code autocompletion takes around 300 - 500 ms to show the results in the autocomplete dropdown The functions I am using come from this file and I do not think it is that big https://github.com/khanakia/entgo_autocomplete_vscode_slow/blob/main/ent/item_create.go |
Understood. Thanks for sharing the example. I mean that I think we can actually fix this -- there is nothing making this unsolvable (for example type checking taking too long). |
Change https://go.dev/cl/531459 mentions this issue: |
@khanakia could you try with gopls@master? I believe you may be running into golang/go#/62665, which was just fixed. To install gopls@master:
|
@leitzler could you (1) try out master, and confirm that you still have problems, and then (2) try out https://go.dev/cl/531459, to see if it resolves your problems? |
It's way better now auto completion requests are around 110ms for my code base. @findleyr Thank you very much. I really appreciate for fixing this. |
Yes! It still exist in master (a slightly old one - |
@khanakia that's good to hear. Thanks for confirming! @leitzler thanks, it looks like that commit includes https://go.dev/cl/530599, which is what I wanted to check. Ok, looks like my small CPU optimization was a major latency regression. I'll submit the revert. Glad we caught this before releasing -- thanks! |
Hello @findleyr, I recently got a bug because of your latest gopls version https://github.com/golang/tools/releases/tag/gopls%2Fv0.14.0-pre.1 |
Reported by @leitzler in slack: https://go.dev/cl/511435 may have caused increased latency in large codebases.
Needs additional investigation before the next release.
The text was updated successfully, but these errors were encountered: