Follow up on post-merge review of performance work on sharded searcher#15
Merged
Follow up on post-merge review of performance work on sharded searcher#15
Conversation
This commit does a couple of things to make the added behavior correct: 1. It reuses the simplified query produced by `selectRepoSet` which in turn reduces the work the shards have to do when evaluating the query 2. It only evaluates the `query.RepoSet` if it's part of a top-level `query.And`. The previous code was too naive when considering that a `query.RepoSet` can appear anywhere in a `query.Q`. See this comment for more details: #14 (comment) 3. It changes the const value that's returned in the simplified version so that `typeRepoSearcher`, which evaluates `query.TypeRepo` queries to a `query.RepoSet` works (the tests in `shards/eval_test.go` break without this.
keegancsmith
approved these changes
Jul 20, 2019
| // Stop after first RepoSet, otherwise we might append duplicate | ||
| // shards to `filtered` | ||
| if len(filtered) != 0 { | ||
| return filtered, and |
Member
There was a problem hiding this comment.
I think you can just always return here, don't have to check len of filtered.
Also return query.Simplify(and), to make Simplify do nothing per shard.
Contributor
Author
|
Hmm, I can take a look again, but when I tried that (returning the
simplified version unconditionally) the tests for TypeRepo broke because
it’s using a RepoSet.
…On Sat 20. Jul 2019 at 15:17, Keegan Carruthers-Smith < ***@***.***> wrote:
***@***.**** approved this pull request.
------------------------------
In shards/shards.go
<#15 (comment)>:
>
- return &query.Const{Value: true}
- })
- query.Simplify(eval)
-
- if len(filtered) != 0 {
- return filtered
+ // Stop after first RepoSet, otherwise we might append duplicate
+ // shards to `filtered`
+ if len(filtered) != 0 {
+ return filtered, and
I think you can just always return here, don't have to check len of
filtered.
Also return query.Simplify(and), to make Simplify do nothing per shard.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#15?email_source=notifications&email_token=AAJBLZN5OIQ3MVVMV4S3SCDQAMF63A5CNFSM4IFGSJ2KYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB7B6POY#pullrequestreview-264497083>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJBLZIKSC5ZGXBRVOMZ4ZLQAMF63ANCNFSM4IFGSJ2A>
.
|
Change-Id: I113b30a29a1b8f61e4969c52b155d7fa09e0cc75
Member
|
Tried out add Simplify, and the tests pass. Also the benchmarks show an improvement: |
Change-Id: I44c3f3face83f5d737a5f9413cf3db3d00c02850
keegancsmith
approved these changes
Jul 22, 2019
Contributor
Author
|
Ah, sweet! Thanks for that! I guess I had a combination of the previous version and this that didn't work. |
2 tasks
msukkari
added a commit
to sourcebot-dev/zoekt
that referenced
this pull request
Apr 21, 2026
- google.golang.org/grpc 1.75.0 -> 1.80.0 (addresses GHSA critical #11: authorization bypass via missing leading slash in :path). - go.opentelemetry.io/otel* 1.42.0/1.33.0 -> 1.43.0 (addresses sourcegraph#15 high: BSD kenv PATH hijack, and sourcegraph#14 medium: unbounded OTLP HTTP response body). Fixes Dependabot alerts 11, 14, 15 on sourcebot-dev/zoekt. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adresses the comments by @keegancsmith in #14 after the merge.
I'm quoting the commit message of the first commit here:
I think the behavior is now correct.
I don't think it's worth it, but if the usecase of multiple RepoSet queries ever arises we can easily remove the
breakand use a set to not append duplicates to thefilteredslice.