roaring-rs
roaring-rs copied to clipboard
ImmutableRoaringBitmap
The java impl contains a ReadOnlyRoaringBitmap that can be backed by a byte buffer. Is there any interest in including a Roaring bitmap that's backed by a borrowed byte slice whose contents are the serialized format? This could be useful for zero-copy deserialization or memory mapped use cases.
Thank you for your issue. I have done some research related to this area that you can read in the issue https://github.com/RoaringBitmap/RoaringFormatSpec/issues/9. I don't know if we want to introduce a new type that is able to deserialize from a byte slice &[u8] and only point to serialized bytes, a lazy type that can deserialize its parts on demand.
There is a 'frozen format' supported by the C and Go versions. It is like the normal serialized format, but it adds some alignment so that you can just reinterpret the bytes without undefined behaviour (in C/C++).
Here is the specification for the frozen format: https://github.com/RoaringBitmap/CRoaring/blob/99f31771e1a372a1ac54abcf4fd3349db35cadf4/src/roaring.c#L2754-L2781