-
Notifications
You must be signed in to change notification settings - Fork 224
Speed up workspace symbol search by filtering before fuzzy matching #3792
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
Speed up workspace symbol search by filtering before fuzzy matching #3792
Conversation
How to use the Graphite Merge QueueAdd the label graphite-merge to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
vinistock
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The insight that we can filter entries before comparing definitely makes sense and we should try to do it.
That said, I'm not sure we need raw_path when path already exists and skipping the to_standardized_path conversions might produce incorrect results on Windows.
4952b35 to
5215014
Compare
|
@vinistock As proposed in #3806 (comment), I removed the Contrary to my initial benchmarks, this change alone seems to provide a ~2-4x speedup, so it does make sense on its own 🙂 |
We're doing extra work fuzzy matching across the whole index, even though only a subset of entries are considered valid results. We can filter out dependency/private entries *before* fuzzy matching, which should speed things up, assuming that fuzzy matching is more expensive than filtering.
5215014 to
646872d
Compare
vinistock
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution!
Motivation
Closes #2660
I want workspace symbol searches to be faster so that I use them more often in my code editor.
Implementation
Currently, fuzzy matching is performed on all symbols, and then dependency/private entries are filtered out. With the assumption that filtering is faster than fuzzy matching, I flipped this around, by first filtering out dependency/private entires, and then doing the fuzzy matching on the remainder.
This turns out to be ~2-4x faster in my benchmarks.
Automated Tests
I didn't update automated tests.