-
Notifications
You must be signed in to change notification settings - Fork 167
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
Use out-of-band buffers for Python buffer protocol supporting objects #365
Comments
Sure. Is there any reason for why |
That's a good question. I don't know. @pitrou, do you know? 🙂 |
Because it's not obvious how to serialize a |
Meaning we don't know what memory to use for backing it? |
Yes, exactly. One way of punting the question is to decide to deserialize a memoryview by recreating a bytes object with similar content. But what if your |
Yeah that makes sense. I think in cloudpickle we have chosen to just use What about other objects like |
It would certainly make sense indeed. But it's not necessarily trivial and someone has to do the work ;-) (note that a memoryview may have been sliced or casted... of course, you could choose to forbid those cases, but you would still have to detect them) |
What challenges do you envision in implementing out-of-band serialization for those other objects? (yeah that's fair. there is a lot the current implementation brushes under the rug ;) |
FWIW opened upstream issue ( https://bugs.python.org/issue40718 ) on serializing builtin |
The one trick for performing out-of-band pickling of |
For objects supporting Python's buffer protocol (like
memoryview
), it would be great to have a path where we use Pickle's protocol 5 for serialization of out-of-band buffers. This should avoid some copies when pickling/unpickling and allow more efficient transmission.The text was updated successfully, but these errors were encountered: