Implement exponential search for rank -> docid batch lookup#2937
Open
waamm wants to merge 2 commits into
Open
Conversation
Collaborator
|
Are there benchmark confirming this is improving something? Can you paste the results in the PR description? |
Author
|
Hi! I added a description of the benchmark I had in mind (I can also add the code). |
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 PR addresses an almost 2 year old TODO by @PSeitz: instead of scanning doc-by-doc to find which document owns a given value rank, we now bracket the answer exponentially and finish with a monotone binary search. Quick informal timings suggest this is roughly ~5× faster on some workloads.
Tests include cases against the old linear-scan implementation.
Edit: On a 10M-document multivalued column where every doc has 2 values, a single
select_batch_in_placecall converting 10k evenly spaced row ranks (on an M4 Max):