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

Autocomplete: Split debounce into two chunks, race the second part with the context retrieving #3149

Merged
merged 5 commits into from
Feb 13, 2024

Conversation

philipp-spiess
Copy link
Contributor

@philipp-spiess philipp-spiess commented Feb 13, 2024

This PR splits the debounce time into two logical chunk. The first 25ms (regardless of how long the debounce time is defined), the behavior will be like it is now: We batch events and don't do any concurrent work.

However after 25ms (which, remember, was the debounce time we had until recently), we start to fetch the context in parallel. The idea is that we have shave off up to 50ms from the context retrieval time.

Here's a visualization of a trace:

Screenshot 2024-02-13 at 11 37 12

As you can see in this specific example, context retrieval could almost be free.

One caveat here is that this will increase CPU pressure (since we start fetching context a bit earlier). That's why I think 25ms is a good value for this since we have used it in the past with the same retrieval algorithm quite successfully.

Test plan

  • Ensure AC still works
  • Check out a trace, e.g.:
Screenshot 2024-02-13 at 11 47 14

@philipp-spiess philipp-spiess requested review from valerybugakov and a team February 13, 2024 10:48
@philipp-spiess philipp-spiess self-assigned this Feb 13, 2024
Copy link
Member

@valerybugakov valerybugakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

vscode/src/completions/get-inline-completions.ts Outdated Show resolved Hide resolved
@philipp-spiess philipp-spiess merged commit b50e9c6 into main Feb 13, 2024
15 checks passed
@philipp-spiess philipp-spiess deleted the ps/ac-split-debounce branch February 13, 2024 13:31
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

Successfully merging this pull request may close these issues.

None yet

2 participants