[ZODB-Dev] Changing the pickle protocol?

Hanno Schlichting hanno at hannosch.eu
Wed Apr 28 07:59:51 EDT 2010


Hi.

The ZODB currently uses a hardcoded pickle protocol one. There's both
the more efficient protocol two and in Python 3 protocol 3. Protocol
two has seen various improvements in recent Python versions, triggered
by its use in memcached.

I'd be interested to work on changing the protocol. How should I approach this?

I can see three general approaches:

1. Hardcode the version to 2 in all places, instead of one.

Pros: Easy to do, backwards compatible with all supported Python versions
Cons: Still inflexible

2. Make the protocol version configurable

Pros: Give control to the user, one could change the protocol used for
storages or persistent caches independently
Cons: More overhead, different protocol versions could have different bugs

3. Make the format configurable

Shane made a proposal in this direction at some point. This would
abstract the persistent format and allow for different serialization
formats. As part of this one could also have different Pickle/Protocol
combinations.

Pros: Lots of flexibility, it might be possible to access the data
from different languages
Cons: Even more overhead


If I am to look into any of these options, which one should I look
into? Option 1 is obviously the easiest and I made a branch for this
at some point already. I'm not particularly interested in option 3
myself, as I haven't had the use-case.

Thanks for any advice,
Hanno


More information about the ZODB-Dev mailing list