[issue17900] Recursive OrderedDict pickling

Serhiy Storchaka report at bugs.python.org
Sat May 4 10:08:18 CEST 2013


Serhiy Storchaka added the comment:

In additional the patch decreases the size of the pickled data, speeds up pickling and unpickling.

$ ./python -c "import collections, pickle; od = collections.OrderedDict((i, i) for i in range(100000)); print(len(pickle.dumps(od)))"

Without patch: 1536827.
With patch: 737578.

$ ./python -m timeit -s "from pickle import dumps; import collections; od = collections.OrderedDict((i, i) for i in range(100000))"  "dumps(od)"

Without patch: 454 msec.
With patch: 361 msec.

$ ./python -m timeit -s "from pickle import dumps, loads; import collections; od = collections.OrderedDict((i, i) for i in range(100000)); x = dumps(od)"  "loads(x)"

Without patch: 1.41 sec.
With patch: 1.15 sec.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17900>
_______________________________________


More information about the Python-bugs-list mailing list