-
Notifications
You must be signed in to change notification settings - Fork 239
ClearBits with AndNot #480
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
Conversation
The intention of ClearBits() is to perform "bulk deletes" of values.
El jue, 7 de ago de 2025, 12:50 a.m., Piyush ***@***.***>
escribió:
… I am not entirely sure why we had the iterator set up.
Clearing bits with AndNot feels correct.
Let me know if there's some case that I've missed here.
Did not remove the ClearBits functions as they're exported public API.
------------------------------
You can view, comment on, or merge this pull request online at:
#480
Commit Summary
- d4f5fa0
<d4f5fa0>
clear bits with and not
File Changes
(2 files <https://github.com/RoaringBitmap/roaring/pull/480/files>)
- *M* BitSliceIndexing/bsi.go
<https://github.com/RoaringBitmap/roaring/pull/480/files#diff-6c94533959c140be49bad4001c54efb949159a7c63b23a72891a61e00be17091>
(10)
- *M* roaring64/bsi64.go
<https://github.com/RoaringBitmap/roaring/pull/480/files#diff-d1a31b49d0996408823b8c849e138363be8a4347d2e57cafd0ad289768845b46>
(12)
Patch Links:
- https://github.com/RoaringBitmap/roaring/pull/480.patch
- https://github.com/RoaringBitmap/roaring/pull/480.diff
—
Reply to this email directly, view it on GitHub
<#480>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADZZAUUGH7ZEJ4DJOL5DX233MLZNDAVCNFSM6AAAAACDKA6SQSVHI2DSMVQWIX3LMV43ASLTON2WKOZTGI4TSMRTGAYTINQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Did you mean Wouldn't |
I would answer yes to both questions.
If AndNot performs better then it is an easy decision. In general, if you
have a performance improvement backed up by a test case that illustrates
the improvement, a merge is almost guaranteed ;-)
El jue, 7 de ago de 2025, 6:27 a.m., Piyush ***@***.***>
escribió:
… *ofpiyush* left a comment (RoaringBitmap/roaring#480)
<#480 (comment)>
The intention of ClearBits() is to perform "bulk deletes" of values.
Did you mean ClearValues there?
Wouldn't AndNot do that and perform better than the iteration?
—
Reply to this email directly, view it on GitHub
<#480 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADZZAUT53X33RDUZEE2GJOD3MNA45AVCNFSM6AAAAACDKA6SQSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTCNRTHE3TMOBRHE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Why I believe that to be the case. The Remove would need to binary search for the container and clear it one value at a time. With AndNot, we should be searching for the container once per container of the foundset. The bitmap containers would be even faster as we can perform bit operation on the entire uint64 with 1 operation. I can add a benchmark later today in case it helps. |
It's almost a "no brainer". Having said that additional testing never
hurts.
El jue, 7 de ago de 2025, 7:23 a.m., Piyush ***@***.***>
escribió:
… *ofpiyush* left a comment (RoaringBitmap/roaring#480)
<#480 (comment)>
Why I believe that to be the case.
The Remove would need to binary search for the container and clear it one
value at a time.
With AndNot, we should be searching for the container once per container
of the foundset.
The bitmap containers would be even faster as we can perform bit operation
on the entire uint64 with 1 operation.
I can add a benchmark later today in case it helps.
—
Reply to this email directly, view it on GitHub
<#480 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADZZAUWC5L3MVCCWOMY5MH33MNHNRAVCNFSM6AAAAACDKA6SQSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTCNRUGE4TGMRVGI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Correct. It is a a community-based project. A PR that improves the performance is almost certain to be merged. |
I was trying not to speak for you Daniel ;-)
El jue, 7 de ago de 2025, 7:41 a.m., Daniel Lemire ***@***.***>
escribió:
… *lemire* left a comment (RoaringBitmap/roaring#480)
<#480 (comment)>
a merge is almost guaranteed ;-)
Correct. It is a a community-based project. A PR that improves the
performance is almost certain to be merged.
—
Reply to this email directly, view it on GitHub
<#480 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADZZAURE6QG6UTO6QXVK3G33MNJQFAVCNFSM6AAAAACDKA6SQSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTCNRUGI2TMNJSGE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Benchmark results on my machine. Given the nature of the change, it should translate to linux servers as well.
Commands and raw outputs
With old code calling ClearBits with the iterator
With
then benchstat
Raw data:
|
I am not entirely sure why we had the iterator set up.
Clearing bits with AndNot feels correct.
Let me know if there's some case that I've missed here.
Did not remove the
ClearBits
functions as they're exported public API.