[New-bugs-announce] [issue9935] Faster pickling of instances
Antoine Pitrou
report at bugs.python.org
Fri Sep 24 03:07:04 CEST 2010
New submission from Antoine Pitrou <pitrou at free.fr>:
This is a bunch of assorted optimizations which make pickling of user-defined classes quite a bit faster.
Example on a minimal instance:
$ python -m timeit -s "import pickle; import collections, __main__; __main__.X=type('X', (), {}); x=X()" "pickle.dumps(x)"
-> before: 100000 loops, best of 3: 8.11 usec per loop
-> after: 100000 loops, best of 3: 2.95 usec per loop
Example on a namedtuple:
$ python -m timeit -s "import pickle; import collections, __main__; __main__.X=collections.namedtuple('X', 'a'); x=X(5)" "pickle.dumps(x)"
-> before: 100000 loops, best of 3: 9.52 usec per loop
-> after: 100000 loops, best of 3: 3.78 usec per loop
Unladen Swallow's pickling benchmark:
### pickle ###
Min: 0.792903 -> 0.704288: 1.1258x faster
Avg: 0.796241 -> 0.706073: 1.1277x faster
Significant (t=39.374217)
Stddev: 0.00410 -> 0.00307: 1.3342x smaller
Timeline: http://tinyurl.com/38elzvv
----------
components: Library (Lib)
files: pickleinst.patch
keywords: patch
messages: 117253
nosy: alexandre.vassalotti, belopolsky, pitrou
priority: normal
severity: normal
stage: patch review
status: open
title: Faster pickling of instances
type: performance
versions: Python 3.2
Added file: http://bugs.python.org/file18986/pickleinst.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9935>
_______________________________________
More information about the New-bugs-announce
mailing list