-
Notifications
You must be signed in to change notification settings - Fork 262
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
"Frozen" serialization format #199
Conversation
Container data is stored in a format identical to their C memory layout. Instead of full deserialization, a lightweight readonly view can be created atop of provided buffer. This reduces amount of allocations and copying and is suitable for creating readonly bitmaps from memory mapped files. * Added new functions: roaring_bitmap_frozen_size_in_bytes() roaring_bitmap_frozen_serialize() roaring_bitmap_frozen_view() * copy_on_write was moved into more generic roaring_array_t.flags To modify copy_on_write behavior, new functions were added: roaring_bitmap_get_copy_on_write() roaring_bitmap_set_copy_on_write() * roaring_bitmap_free() now takes pointer to a constant bitmap
Fantastic. I consider that this is a satisfactory fix for #74 |
@andreigudkov Hello, why roaring_bitmap_frozen_view input buf must align 32, would it still work if I remove this restriction? Line 3215 in 33da04d
|
If I recall everything correctly, then:
Probably things have changed since frozen format was introduced, and maybe this check is not required anymore. |
They do not, at least not currently. |
@PerpEternal It would be possible to revisit the alignment requirement, but someone needs to review the code and make sure that it is safe to lift it, and to run tests. If you are interested, don't hesitate. Ideally, we would want unit tests to make sure that it all works out. |
@lemire Are you sure that you do not depend on the alignment? I can see that currently on x64 the alignment is either 32 or 64 (when I created frozen format, it was always 32). CRoaring/src/containers/bitset.c Line 75 in 8fc18ac
|
I am sure of nothing. I only wrote that it could be revisited. |
Container data is stored in a format identical
to their C memory layout.
Instead of full deserialization, a lightweight readonly
view can be created atop of provided buffer.
This reduces amount of allocations and copying
and is suitable for creating readonly bitmaps from
memory mapped files.
Added new functions:
roaring_bitmap_frozen_size_in_bytes()
roaring_bitmap_frozen_serialize()
roaring_bitmap_frozen_view()
copy_on_write was moved into more generic roaring_array_t.flags
To modify copy_on_write behavior, new functions were added:
roaring_bitmap_get_copy_on_write()
roaring_bitmap_set_copy_on_write()
roaring_bitmap_free() now takes pointer to a constant bitmap