[issue19780] Pickle 4 frame headers optimization
Serhiy Storchaka
report at bugs.python.org
Tue Nov 26 15:55:48 CET 2013
Serhiy Storchaka added the comment:
> If it's an optimizatio, can I see some benchmarks numbers? :-)
First create two files. Run unpatched Python:
./python -c "import pickle, lzma; data = [bytes([i])*2**16 for i in
range(256)]; with open('test.pickle4', 'wb'): pickle.dump(data, f, 4)"
Then run the same with patched Python for 'test.pickle4opt'.
Now benchmark loading.
$ ./python -m timeit "import pickle;" "with open('test.pickle4', 'rb',
buffering=0) as f: pickle.load(f)"
10 loops, best of 3: 52.9 msec per loop
$ ./python -m timeit "import pickle;" "with open('test.pickle4opt', 'rb',
buffering=0) as f: pickle.load(f)"
10 loops, best of 3: 48.9 msec per loop
The difference is about 5%. On faster computers with slower files (sockets?) it
should be larger.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19780>
_______________________________________
More information about the Python-bugs-list
mailing list