perf: Faster advanceIfNeeded for Roaring iterators. - #20129
Open
gianm wants to merge 2 commits into
Open
Conversation
This patch adds SeekableRoaringIntIterator and uses it instead of ImmutableRoaringBitmap#getIntIterator in WrappedImmutableRoaringBitmap. The seekable iterator performs better than the builtin iterator, because it uses PointableRoaringArray#advanceUntil to advance containers, which is capable of binary search. This patch also updates various code paths that reset bitmap iterators in vectorized code paths to get them all using common logic: they should reset the iterator if the new start is prior to the old end, rather than comparing start-to-start or end-to-end.
Contributor
Author
|
Benchmarks, using the newly added case in |
| .setSimpleTestingIndexSchema(schemaInfo.getAggsArray()) | ||
| .setMaxRowCount(rowsPerSegment) | ||
| .build(); | ||
| return DataSegment.builder() |
|
|
||
| @ParameterizedTest(name = "{0}") | ||
| @MethodSource("bitmaps") | ||
| public void testSequentialIteration(final String name, final ImmutableRoaringBitmap bitmap) |
|
|
||
| @ParameterizedTest(name = "{0}") | ||
| @MethodSource("bitmaps") | ||
| public void testPeekNextDoesNotAdvance(final String name, final ImmutableRoaringBitmap bitmap) |
|
|
||
| @ParameterizedTest(name = "{0}") | ||
| @MethodSource("bitmaps") | ||
| public void testRandomSeeksInBothDirections(final String name, final ImmutableRoaringBitmap bitmap) |
|
|
||
| @ParameterizedTest(name = "{0}") | ||
| @MethodSource("bitmaps") | ||
| public void testAscendingSeeks(final String name, final ImmutableRoaringBitmap bitmap) |
|
|
||
| @ParameterizedTest(name = "{0}") | ||
| @MethodSource("bitmaps") | ||
| public void testRandomOperationsMatchReference(final String name, final ImmutableRoaringBitmap bitmap) |
|
|
||
| @ParameterizedTest(name = "{0}") | ||
| @MethodSource("bitmaps") | ||
| public void testCloneIsIndependent(final String name, final ImmutableRoaringBitmap bitmap) |
|
|
||
| @ParameterizedTest(name = "{0}") | ||
| @MethodSource("bitmaps") | ||
| public void testCloneDoesNotShareCursor(final String name, final ImmutableRoaringBitmap bitmap) |
|
|
||
| @ParameterizedTest(name = "{0}") | ||
| @MethodSource("bitmaps") | ||
| public void testAdvanceIfNeededDoesNotMoveBackwards(final String name, final ImmutableRoaringBitmap bitmap) |
|
|
||
| @ParameterizedTest(name = "{0}") | ||
| @MethodSource("bitmaps") | ||
| public void testAdvanceIfNeededOnExhaustedIteratorIsANoOp(final String name, final ImmutableRoaringBitmap bitmap) |
FrankChen021
left a comment
Member
There was a problem hiding this comment.
I have reviewed the code for correctness, edge cases, concurrency, and integration risks; no issues found.
Reviewed 13 of 13 changed files.
This is an automated review by Codex GPT-5.6-Luna(max)
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 patch adds SeekableRoaringIntIterator and uses it instead of ImmutableRoaringBitmap#getIntIterator in WrappedImmutableRoaringBitmap.
The seekable iterator performs better than the builtin iterator, because it uses PointableRoaringArray#advanceUntil to advance containers, which is capable of binary search.
This patch also updates various code paths that reset bitmap iterators in vectorized code paths to get them all using common logic: they should reset the iterator if the new start is prior to the old end, rather than comparing start-to-start or end-to-end.