perf: Faster advanceIfNeeded for Roaring iterators. - #20129
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.
|
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
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)
|
|
||
| @ParameterizedTest(name = "{0}") | ||
| @MethodSource("batches") | ||
| public void testMatchesIndexedRows(String name, int[][] batches, List<Integer> expected) |
FrankChen021
left a comment
There was a problem hiding this comment.
I have reviewed the code for correctness, edge cases, concurrency, and integration risks; no issues found.
Reviewed 14 of 14 changed files.
Validation: focused git diff --check passed. Builds and tests were not run.
This is an automated review by Codex GPT-5.6-Luna(max)
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.