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

Add support for pickle protocol 4: It can be *much* faster #21

Open
jamadden opened this issue Aug 23, 2016 · 2 comments
Open

Add support for pickle protocol 4: It can be *much* faster #21

jamadden opened this issue Aug 23, 2016 · 2 comments

Comments

@jamadden
Copy link
Member

Pickle protocol 4, introduced with Python 3.4, brings some nice enhancements. In particular, it turns out that the framing feature introduced in protocol 4 "with a potentially huge performance impact" really does have a big impact.

I'm using zodbpickle to gain access to pickle protocol 3 under Python 2 in RelStorage. Under Python 3, I use the builtin pickle and (under 3.4 and up) protocol 4.

In one test in RelStorage, protocol 4 takes about 5 seconds to handle an object, whereas protocol 3 takes about 30 seconds. (To workaround this in Python 2, I have to buffer a large object into memory; even using buffered IO from an SSD and with the data putatively in the buffer cache. Of course, this varies by system, but the slower the filesystem/stream the worse the problem).

It would be nice to have protocol 4 available to python 2.

I don't know how much work would be involved in the backport (and making sure that no_load stays supported). I personally don't have any concrete plans to do this work right now (maybe someday), but I thought I'd throw this feature request out there along with the motivating numbers in case it intrigues any one else.

@moreati
Copy link

moreati commented Oct 3, 2018

I'm going to take a stab at this. My plan is to rebase on the CPython 3.7 code.

@moreati
Copy link

moreati commented Oct 7, 2018

I've been unable to get the _pickle module from Python 3.7 working on Python 3.6. My efforts are in https://github.com/moreati/pikl/tree/zodbpickle-py37-backport. I'll try again with _pickle from 3.6 on 3.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants