codeintel: Speed up syntactic and search-based usages using batch APIs#64078
Conversation
c53e4b8 to
5603258
Compare
we're not using the orderedmap for lookups and slices are easier to iterate over in Go
2154933 to
1fdb30d
Compare
| ) | ||
|
|
||
| // SU_CHUNK_SIZE is the batch size for SCIP documents and git diffs we load at a time. | ||
| var SU_CHUNK_SIZE = 20 |
There was a problem hiding this comment.
- This is not used in a lot of places, please use a clearer name instead of an abbreviation like
SU_. - This should be a
constnot avarunless it needs to be modified somewhere. - Please document the reason for choosing this value. Did you do some napkin math/apply some heuristics? Did you do any benchmarks? Was it arbitrarily chosen?
There was a problem hiding this comment.
This is not used in a lot of places, please use a clearer name instead of an abbreviation like SU_.
👍 I thought I'd match the SU_ prefix on the SyntacticUsages error enum, but I can spell out SYNTACTIC_USAGES instead.
Please document the reason for choosing this value. Did you do some napkin math/apply some heuristics? Did you do any benchmarks? Was it arbitrarily chosen?
I collected traces for various sizes (on my local machine) and 20 gave me "nice looking" ones. In general I expect 100 documents to be on the "higher end" of the number of documents to retrieve for a single syntactic usage search and 5 concurrent queries and git requests seems like a reasonable trade-off for concurrency vs load.
Happy to tweak this number. I don't think it makes sense to configure this at the instance level, but maybe we could accept a query parameter to let us easily test different amount of concurrency on S2.
Co-authored-by: Varun Gandhi <varun.gandhi@sourcegraph.com>
Closes https://linear.app/sourcegraph/issue/GRAPH-771/chunk-syntactic-usage-tasks-and-use-batch-apis-to-handle-chunks
This is the last step for properly implementing #63971. We split the
candidateFilessearch produces into chunks and process these in parallel using the new batch api onMappedIndex.Test plan
Existing tests continue passing