Skip to content
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

No way to do zerocopy deserialize #57

Open
giannitedesco opened this issue Apr 5, 2020 · 2 comments
Open

No way to do zerocopy deserialize #57

giannitedesco opened this issue Apr 5, 2020 · 2 comments

Comments

@giannitedesco
Copy link

I'd like to Bitmap.deserialize from a read-only mmap file which contains a large roaring bitmap. To do that I have to copy the bitmap in to a bytes by slicing it, because if I use a memoryview instead, I get the error

  File "pyroaring/abstract_bitmap.pxi", line 726, in pyroaring.AbstractBitMap.deserialize
TypeError: expected bytes, memoryview found

It should be possible to use the buffer protocol in conjunction with roaring_bitmap_portable_deserialize_safe

@giannitedesco
Copy link
Author

This problem is exacerbated if the bitmap is stored inside a much larger file without a size field which might allow slicing out only the bitmap bytes.

It might be nice, by the way, to support the frozen format for these sorts of purposes to avoid doing a lot of allocations when bitmaps are in read-only mmaps.

@Ezibenroc
Copy link
Owner

Hello and sorry for the delay. I do not have much time presently, so I cannot implement this feature myself, but I would be glad to review any pull request.

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

No branches or pull requests

2 participants