-
Notifications
You must be signed in to change notification settings - Fork 159
matchtree: special case word search #526
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
Conversation
Still need to add tests for this
|
@stefanhengl I couldn't help myself and wrote a little more code which should make this not break anything. |
|
@stefanhengl Thinking about next steps here. I believe this is working. What isn't known if this actually makes a difference.
|
|
I ran a couple of tests and it looks like we are finding too many results. EG a search for EDIT: |
|
Performance looks promissing (4.8x faster). |
|
\o/ |
|
@keegancsmith Shall we roll this out? I think this can be live while we polish it. |
I think writing a test is a minumum before landing. You wanna do that? Also I wonder if we should record running this code path as another Stat (instead of regexpsconsidered). But regexpsconsidered is probably fine. Edit: I do believe this change is safe though, so making it in before branch cut would be awesome. |
👍 |
Not sure. Given the docstring we probably shouldn't count evaluations of the wordMatchTree as regexp. I removed the counter for wordMatchTree. Looking at |
keegancsmith
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.
@stefanhengl I can't approve, but LGTM. Ship it :)
A common search Zoekt gets from Sourcegraph is "\bLITERAL\b". With this PR we avoid the regex engine for these type of queries and provide something faster.
Local benchmarks show that the new code runs 4.8x faster for select queries.
Co-authored-by: @stefanhengl