-
Notifications
You must be signed in to change notification settings - Fork 544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement nextSetBit #253
implement nextSetBit #253
Conversation
I'll merge and try to throw in some benchmarks. |
(Great work btw.) |
I changed the name "nextValue" because I think that's more in the spirit of the API. The benchmark is in as of the last commit...
|
So it's multiplicatively slower because of container lookup overhead and binary searches. I didn't try to optimise this code at all though. Rather than implementing the bitset API verbatim it might have been interesting to get the next page of values after a given value, like a skip list. |
Right. It is an API designed to work well for BitSet. It is a terrible way to iterate over values in a Roaring bitmap. |
@lemire agreed that it's a terrible iteration strategy to purposefully forget where you are each time you go back to the data structure, but it potentially has interesting use cases, either to retrieve an iterator starting at an offset, or to fill an array of values after an offset. This would be useful for stateless pagination. |
If you retrieve more than one value each time, thus amortizing the search cost, then it makes a lot of sense, I agree. |
This implements similar functionality to
java.util.BitSet.nextSetBit
, except the next bit is returned as a long, since RoaringBitmaps can contain all 32 bits.