Skip to content

Conversation

coszio
Copy link
Contributor

@coszio coszio commented Aug 6, 2025

This PR extracts the BufferedDynamicFlags logic into its own structure, which buffers writes and can only write to disk manually.

To handle reads, two new structures have been created:

  • RoaringFlags: uses the BufferedDynamicFlags as storage only, and keeps a RoaringBitmap in memory for reads.
  • BitvecFlags: same BufferedDynamicFlags storage, but with a BitVec in memory for reads.

This enables the flexibility of choosing the in-memory structure. For example, vector storages need a reference to a bitslice, which can only be provided by BitvecFlags. On the other hand, null index benefits from lower memory overhead and does not need a bitslice explicitly.

@coszio coszio requested review from timvisee and generall August 6, 2025 18:47

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

Copy link
Member

@timvisee timvisee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks!

I carefully checked the way we handle the length of structures here, as it's important for reliable iterators. While there's a bit of indirection there, everything looks sound.

@timvisee timvisee self-assigned this Aug 7, 2025
@timvisee timvisee merged commit 6344ab8 into dev Aug 7, 2025
16 checks passed
@timvisee timvisee deleted the bitvec-flags branch August 7, 2025 09:30
timvisee added a commit that referenced this pull request Aug 11, 2025
* separate flags buffering and in-memory container

* new bitvec flags

* fmt

* clippy

* make BufferedDynamicFlags public to crate only

* clear cache after loading

* clippyyy

* improve comment

* Use resize with a constant to eliminate a hot closure

* Add comment on why we take subslice of bitslice

---------

Co-authored-by: timvisee <tim@visee.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants