roaring-rs icon indicating copy to clipboard operation
roaring-rs copied to clipboard

ImmutableRoaringBitmap

Open saik0 opened this issue 3 years ago • 3 comments

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.

saik0 avatar Dec 28 '21 07:12 saik0

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.

Kerollmops avatar Jan 03 '22 15:01 Kerollmops

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++).

lemire avatar Jan 03 '22 15:01 lemire

Here is the specification for the frozen format: https://github.com/RoaringBitmap/CRoaring/blob/99f31771e1a372a1ac54abcf4fd3349db35cadf4/src/roaring.c#L2754-L2781

josephglanville avatar Jan 07 '22 03:01 josephglanville