Skip to content

Conversation

@janko
Copy link
Contributor

@janko janko commented Oct 25, 2025

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.

@janko janko requested a review from a team as a code owner October 25, 2025 12:11
@graphite-app
Copy link

graphite-app bot commented Oct 25, 2025

How to use the Graphite Merge Queue

Add 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.

Copy link
Member

@vinistock vinistock left a 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.

@janko janko force-pushed the speed-up-workspace-symbol-search branch from 4952b35 to 5215014 Compare November 10, 2025 14:54
@janko janko changed the title Speed up workspace symbol search Speed up workspace symbol search by filtering before fuzzy matching Nov 10, 2025
@janko
Copy link
Contributor Author

janko commented Nov 10, 2025

@vinistock As proposed in #3806 (comment), I removed the URI::Generic#to_standardized_path optimizations and kept only doing filtering before fuzzy matching.

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.
@janko janko force-pushed the speed-up-workspace-symbol-search branch from 5215014 to 646872d Compare November 10, 2025 21:11
@vinistock vinistock added server This pull request should be included in the server gem's release notes other Changes that aren't bugfixes, enhancements or breaking changes labels Nov 10, 2025
Copy link
Member

@vinistock vinistock left a 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!

@vinistock vinistock merged commit 1104fdd into Shopify:main Nov 10, 2025
23 of 24 checks passed
@janko janko deleted the speed-up-workspace-symbol-search branch November 10, 2025 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

other Changes that aren't bugfixes, enhancements or breaking changes server This pull request should be included in the server gem's release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve workspace/symbol request's performance

3 participants