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

x/tools/gopls: optimize deep completion #63263

Open
findleyr opened this issue Sep 27, 2023 · 0 comments
Open

x/tools/gopls: optimize deep completion #63263

findleyr opened this issue Sep 27, 2023 · 0 comments
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@findleyr
Copy link
Contributor

Noticed while looking into a regression that caused deep completions to run spuriously (#62665): there appeared to be a lot of low-hanging fruit to optimize the performance of deep completions. For example, I analyzed one of our completion benchmarks on Kubernetes, and observed that type checking was only 65ms, while deep completion took an additional 100-200ms. I think we can get completion latency much closer to type checking latency, even while scanning many deep candidates.

The potential optimizations I see are very similar to what we did for workspace/symbol requests:

  1. Add concurrency: completion is single-threaded at present.
  2. Avoid pre-building strings, by performing fuzzy match before assembling the fully qualified symbol path.
  3. Use a faster fuzzy matcher (and fix ranking edge cases)
  4. Exclude deep candidates earlier, once their score is too low (we only ever serve 3 candidates!). If we make scores only decrease throughout 'addCandidate', and exit early, we can likely avoid a lot of unnecessary type inference.

Originally posted by @findleyr in #62665 (comment)

@findleyr findleyr added this to the gopls/backlog milestone Sep 27, 2023
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

2 participants