I had the imprudence to pay close attention to the performance of the language, but this will not happen again. For the work that I do, the development productivity is much more significant than the performance of the language itself. It doesn't bother me at all that Python 3 is a bit slower than the last 2.x release used in production (2.5). History has shown that Python developers are pretty good at optimizing, and now that the language has stabilized, we can count on a large number of optimizations in the 3rd branch.
Python 3 is not so slow today. For the work that I do - web application development - I find that the first release of Python 3 is roughly equivalent to Python 2.5.x, and this is much more important to me than evaluation with pystone or some other abstract measurement.
Test # 1: pystone
As for pystone, here are the results on an old uniprocessor Unix machine that I use:
')
$ python2.5 /usr/local/lib/python2.5/test/pystone.py
Pystone(1.1) time for 50000 passes = 1.75781
This machine benchmarks at 28444.4 pystones/second
$ python2.6 /usr/local/lib/python2.6/test/pystone.py
Pystone(1.1) time for 50000 passes = 1.46094
This machine benchmarks at 34224.6 pystones/second
$ python3.0 /usr/local/lib/python3.0/test/pystone.py
Pystone(1.1) time for 50000 passes = 1.85938
This machine benchmarks at 26890.8 pystones/second
Test # 2: Web Application
The binding (albeit rough) test of web layouts is getting a wiki page on the same old machine, while gvim and some other applications are also running.
ab -n 1000 127.0.0.1:8002/qwiki/foo/
Req/second
Python 2.5 174.79
Python 2.6 204.29
Python 3.0 173.49
Test # 3: web framework template
This test is based on the template test included in the
Genshi package and uses the timeit module, counting the average time of 10 runs of creating a large html table using the following
Qpy template:
# this is to provide a Qpy template for use in comparison # with the Genshi "bigtable" benchmark. table = [dict(a=1,b=2,c=3,d=4,e=5,f=6,g=7,h=8,i=9,j=10) for x in range(1000)] def qpy_template:xml(): '<table>' for row in table: '<tr>' for col in row.values(): '<td>%s</td>' % col '</tr>' '</table>'
You can see that Qpy is not the only module that has received a performance boost in Python 2.6 and Python 3.0, and I am sure that optimization efforts will be made to bring the performance of some modules back to their previous level.
$ python2.5 bigtable.py
ElementTree 736.43 ms
cStringIO 36.46 ms
StringIO 141.10 ms
list concat 22.73 ms
Qpy Template 129.35 ms
$ python2.6 bigtable.py
ElementTree 656.99 ms
cStringIO 30.85 ms
StringIO 131.95 ms
list concat 16.37 ms
Qpy Template 39.54 ms
$ python3.0 bigtable.py
ElementTree 449.60 ms
StringIO 138.03 ms
list concat 21.70 ms
Qpy Template 36.36 ms
Conclusion
There are good reasons why someone might choose Python 2.x instead of Python 3.0, but performance will not be one of them for most developers.