[New-bugs-announce] [issue16034] bz2 module appears slower in Python 3.x versus Python 2.x
Victor Hooi
report at bugs.python.org
Tue Sep 25 06:39:33 CEST 2012
New submission from Victor Hooi:
Hi,
I was writing a script to parse BZ2 blogfiles under Python 2.6, and I noticed that bz2file (http://pypi.python.org/pypi/bz2file) seemed to perform much slower than with bz2 (native):
http://stackoverflow.com/questions/12575930/is-python-bz2file-slower-than-bz2
I wrote a dummy script that basically just reads through the file, one for bz2 and one for bz2file (attached):
[vichoo at dev_desktop_vm Desktop]$ time /opt/python3.3/bin/python3.3 testbz2.py > /dev/null
real 0m5.170s
user 0m5.009s
sys 0m0.030s
[vichoo at dev_desktop_vm Desktop]$ time /opt/python3.3/bin/python3.3 testbz2file.py > /dev/null
real 0m5.245s
user 0m4.979s
sys 0m0.060s
[vichoo at dev_desktop_vm Desktop]$ time /opt/python2.7/bin/python2.7 testbz2.py > /dev/null
real 0m0.500s
user 0m0.410s
sys 0m0.030s
[vichoo at dev_desktop_vm Desktop]$ time /opt/python2.7/bin/python2.7 testbz2file.py > /dev/null
real 0m5.801s
user 0m5.529s
sys 0m0.050s
I also executed "echo 3 > /proc/sys/vm/drop_cache" between each run.
>From this, it appears that Python 2.x's bz2 is fast, but bz2file is slow - and that Python 3.x's bz2 is slow.
Obviously, there could be an issue with the methdology above - however, if not, do you know if there are any performance regressions in bz2 from Python 2.x to 3.x?
Thanks,
Victor
----------
components: None
files: testbz2file.py
messages: 171216
nosy: victorhooi
priority: normal
severity: normal
status: open
title: bz2 module appears slower in Python 3.x versus Python 2.x
type: performance
versions: Python 3.3
Added file: http://bugs.python.org/file27288/testbz2file.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16034>
_______________________________________
More information about the New-bugs-announce
mailing list