Binary search the entries when all suffixes have the same length in a leaf block. - #11722
Conversation
jpountz
left a comment
There was a problem hiding this comment.
Nice, have you been able to measure a speedup with this change?
I'm not sure how well covered same-length terms are covered in our tests, maybe add a new one to BasePostingsFormatTestCase? It looks like comments were copy-pasted and need updating too, e.g. references to "scanning" since we're no longer scanning a block in this case.
|
@jpountz Method took:
Whole search took:
In my test case, scanToTerm only took 3.5% of the whole search execute time, so it could only got a small speedup. |
1M documents is too much for a unit test, I was thinking of a smaller dataset, e.g. 200 fixed-size IDs and we'd make sure that the binary search works as expected for both |
Got it. I think it is a good idea for a unit test. |
|
@jpountz |
jpountz
left a comment
There was a problem hiding this comment.
I left a minor suggestion but it looks good to me. Can you add a CHANGES entry under 9.5?
|
@jpountz Thranks for your review and suggestion. I have added a CHANGES entry and the code that assert the value of termsEnum.term() is correct after seeking. |
jpountz
left a comment
There was a problem hiding this comment.
Given the test failure, it looks like you need to run gradlew tidy to fix indentation.
|
@vsop-479 I addressed failures related to formatting but there seems to still be a test failure. |
|
@jpountz Thranks for your commit. |
|
@jpountz I have fixed the code and passed the tests locally. Please have a review. |
|
@mikemccand You might want to have a look at this change since (I think) you are one of the most familiar ones with the original code. |
|
I had to revert this change because of test failures, e.g. this seed reproduces on the main branch: It seems like this test exercises some logic that |
|
@jpountz I have fixed the code and passed the test, but i can’t find the new commit in this PR (because it has been merged and reverted ?). |
|
A new PR would be great, thank you for looking into these failures! |
In scanToTerm phase, binary search may have a better performance when all suffixes have the same length in a leaf block.