ion-python icon indicating copy to clipboard operation
ion-python copied to clipboard

Plans for implementing Pickle 5 serialization protocol?

Open edoakes opened this issue 5 years ago • 5 comments

Hi all, I work on Ray and we have users who are interested in using Ion in conjunction with Ray. We use the pickle 5 serialization protocol internally, so if Ion were to support pickle 5 that would be ideal to provide zero-copy serialization for Ray users who want to use it :)

Any plans/thoughts here?

edoakes avatar Jul 21 '20 22:07 edoakes

Hi @edoakes, my first reaction is that supporting pickle 5 sounds like a good idea. I have very little existing knowledge about pickle, and I think the other maintainers of ion-python would likely say the same.

Would you be able to give us a rough idea of what would be required for ion-python to support pickle 5?

tgregg avatar Jul 21 '20 22:07 tgregg

That's great to hear!

Let me loop in our local serialization expert who will be able to give you a better idea :) cc @suquark

edoakes avatar Jul 21 '20 23:07 edoakes

Here is the doc for pickle5: https://www.python.org/dev/peps/pep-0574/ I think to fully support pickle5, we need some C++/Cython code to expose the underlying buffer of python objects. I am not sure if it is a good idea, because it looks like Ion-Python is implemented with pure python code.

suquark avatar Jul 21 '20 23:07 suquark

It's implemented in pure python today, although we are aware that we are going to need to use a native code extension to achieve performance on par with other common python serialization libraries that use C extensions (like simplejson). We haven't been able to prioritize that work yet, though.

tgregg avatar Jul 21 '20 23:07 tgregg

Yep, it is pretty good to have a native code extension. I also notice that ion-python uses bytearray, maybe it is useful for faster serialization. Let me dig a bit into it first.

suquark avatar Jul 21 '20 23:07 suquark