Optimize IndexedDISI by implementing binary search for sparseDocs in … - #16349
Optimize IndexedDISI by implementing binary search for sparseDocs in …#16349rajat315315 wants to merge 3 commits into
Conversation
|
I have run the AdvanceBenchmark JMH suite to evaluate the impact of the new binary search implementation on IndexedDISI.The results demonstrate that the inlinedBranchlessBinarySearch approach provides a performance improvement over the existing linearSearch implementation. Throughput Comparison
Existing methods (linearSearch and binarySearch) showed no significant performance degradation on the PR branch compared to main, ensuring that these changes are safe for current workloads. |
|
This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the dev@lucene.apache.org list. Thank you for your contribution! |
Fixes #16348
Description
This fix would be particularly useful in the case when we are accessing targetDoc which belong to the same block.
In that case, we won't need to do a linear search over the 4096 Docs in the worst case. It would take only 12 operations
log(N).In the worst case, where the block is
SPARSEand there are 4096 DocIds stored in it and we need to get all docs.. we would be usingadvance()function call which would need to calladvanceWithinBlock()4096 times totalling the number of operations to ~8 million.