Add functions to skip forward/backward with an iterator, and use it to simplify roaring_bitmap_range_uint32_array#741
Merged
lemire merged 2 commits intoRoaringBitmap:masterfrom Oct 1, 2025
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces efficient iterator skipping functionality to the roaring bitmap library. It adds forward and backward skip operations for iterators and refactors the range array function to use the new iterator-based approach.
- Adds
roaring_uint32_iterator_skipandroaring_uint32_iterator_skip_backwardfunctions - Implements container-level skip operations for array, bitset, and run containers
- Refactors
roaring_bitmap_range_uint32_arrayto use the new skip functionality instead of the old complex implementation
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| include/roaring/roaring.h | Adds public API declarations for iterator skip functions and updates documentation |
| include/roaring/containers/containers.h | Declares container-level skip function APIs |
| include/roaring/roaring_array.h | Removes declaration for old ra_range_uint32_array function |
| src/roaring.c | Implements iterator skip functions and simplifies range array function |
| src/containers/containers.c | Implements container-level skip operations for all container types |
| src/roaring_array.c | Removes old ra_range_uint32_array implementation |
| tests/toplevel_unit.c | Adds comprehensive tests for iterator skip functionality and improves existing test |
| tests/container_comparison_unit.c | Adds container-level tests for skip operations and fixes assertion |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
dc18603 to
363d32e
Compare
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This allows efficently skipping over items in an iterator.
Greatly simplify the implementation of roaring_uint32_iterator_skip using `roaring_uint32_iterator_skip`. This also eliminates an unessisary allocation, and possible failure. For backward compat, `roaring_bitmap_range_uint32_array` still returns a bool, but it always returns true since it can no longer fail.
363d32e to
c97996e
Compare
lemire
approved these changes
Sep 23, 2025
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.
roaring_uint32_iterator_skipandroaring_uint32_iterator_skip_backwardfunctions which advance an iterator by multiple positions efficiently.roaring_uint32_iterator_skipin conjunction with the existingroaring_uint32_iterator_readfunction to implement theroaring_bitmap_range_uint32_arrayfunctionThe rust bindings will also be able to use the new skipping functions for implementing
Iterator::nth.