On 06/03/2016 11:34, Tony van der Hoff wrote:
Hi, I've been experimenting with a short test program under python 2.7
and python 3.4.2. It's a simple read from file, and locate a word therein.
I get the (subjective) impression that python2 is slightly faster than
python3. Is that correct? Is there any documentation to support this?
I've also found that 3 was consistently slower than 2 on various
benchmarks. Perhaps 10 to 20% slower (also 3.4 vs. 2.7).
One example (processing a jpeg file), both with CPython on Windows[1]:
Python 3.4: 6.8 seconds
Python 2.7: 5.4 seconds
But then:
PyPy: 2.1 seconds [2]
PyPy I think is only compatible with Python 3 code (there are a few
other issues too).
([1] Windows Python I believe is a little slower than on Linux, for the
same version of Python and on the same hardware. I think due to CPython
being compiled with MSVC not gcc. But it would affect 2 and 3 equally.)
([2] With larger data, PyPy gets progressively faster compared with
normal Python, as it can optimise big loops better. This test was with
0.5 Mpixels of data)
--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list