Serhiy Storchaka added the comment:

bz2 will gain great benefit from such optimization too.

Microbenchmark results:

$ ./python -m timeit -s "import gzip" -- "f=gzip.GzipFile('words.gz', 'r')" 
"for line in f: pass"
2.7:                 10 loops, best of 3: 374 msec per loop
3.2:                 10 loops, best of 3: 325 msec per loop
3.3:                 10 loops, best of 3: 311 msec per loop
3.4:                 10 loops, best of 3: 328 msec per loop
3.5:                 10 loops, best of 3: 325 msec per loop
3.5+decomp-optim.v3: 10 loops, best of 3: 61.2 msec per loop

$ ./python -m timeit -s "import bz2" -- "f=bz2.BZ2File('words.bz2', 'r')" "for 
line in f: pass"
2.7:                 10 loops, best of 3: 92.1 msec per loop
3.2:                 10 loops, best of 3: 92.4 msec per loop
3.3:                 10 loops, best of 3: 567 msec per loop
3.4:                 10 loops, best of 3: 535 msec per loop
3.5:                 10 loops, best of 3: 603 msec per loop
3.5+decomp-optim.v2: 10 loops, best of 3: 525 msec per loop
3.5+decomp-optim.v3: 10 loops, best of 3: 131 msec per loop

$ python -m timeit -s "import lzma" -- "f=lzma.LZMAFile('words.xz', 'r')" "for 
line in f: pass"
2.7:                 10 loops, best of 3: 49.4 msec per loop
3.3:                 10 loops, best of 3: 1.67 sec per loop
3.4:                 10 loops, best of 3: 400 msec per loop
3.5:                 10 loops, best of 3: 423 msec per loop
3.5+decomp-optim.v3: 10 loops, best of 3: 89.6 msec per loop

The fact that bz2 and lzma have 5-15% regression in 3.5 (comparing to 3.4) 
makes applying this patch to 3.5 more desirable.

----------
Added file: http://bugs.python.org/file39640/decomp-optim.v3.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18003>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to