[issue16551] Cleanup the pure Python pickle implementation
Serhiy Storchaka
report at bugs.python.org
Sun Apr 7 15:25:41 CEST 2013
Serhiy Storchaka added the comment:
In response to Alexandre's comment on Rietveld. Access to a local variable is faster than to a global one and the current implementation uses this for struct.pack. I just use same trick for struct.unpack. Here is a microbenchmark which demonstrate some effect of this optimization. I got 0.6491418619989417, 0.6947214259998873, and 0.5394902769985492 for optimized, non-optimized and advanced optimized functions.
Of course, we can achieve even better effect if we will cache not only struct.pack, but struct.Struct('<i').pack, struct.Struct('B').pack, etc. I were considered this as a reason for other patch, but we can do it in this issue.
----------
Added file: http://bugs.python.org/file29715/bench.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16551>
_______________________________________
More information about the Python-bugs-list
mailing list