New and Improved - Python 3.1
Updated to include a comparison to Python 2.5
Python 3.1 has closed much of the performance gap between 3.x and 2.x, as well as delivering some new features and enhancements to the language and stdlib. Enhancement that caught my eye first: re.sub | re.subn | re.split now accept a flags parameter, no more remembering how to pass that in as part of the regex. And I think I'm going to like auto numbered format() fields i.e. 'We are the {} who say {}'.format('Knights', 'Ni!').
On first blush it may not seem that the performance gap has been closed very much. A simplistic web app benchmark:
siege -b -t60s -c2 http://localhost:8000/ Old machine (light mail server load / FreeBSD 7.2) Python 2.6 520.91 trans/sec Python 3.1 388.38 trans/sec Newer Virtual Machine (moderately loaded server / FreeBSD 7.2) Python 2.6 1568.58 trans/sec Python 3.1 1220.92 trans/sec Faster Virtual Machine (quiet server / Debian 5 - OpenVZ) Python 2.5 2304.78 trans/sec [1] Python 3.1 1960.07 trans/sec
Looking deeper, I'm seeing little difference between 2.6 and 3.1, here benchmarking a more involved web app benchmark than "hello world" that is probably more representative of a typical yet simple web app:
siege -b -t60s -c2 http://localhost:8002/ Old machine (light mail server load / FreeBSD 7.2) Python 2.6 197.40 trans/sec Python 3.1 194.09 trans/sec Newer Virtual Machine (moderately loaded server / FreeBSD 7.2) Python 2.6 649.57 trans/sec Python 3.1 629.50 trans/sec Faster Virtual Machine (quiet server / Debian 5 - OpenVZ) Python 2.5 765.88 trans/sec Python 3.1 850.24 trans/sec
[1] Note Python 2.5 being compared in this test instance
From what I can tell, for the sorts of tasks I run into, Python 3.1 appears to perform as well or better than Python 2.5 and is approaching the current speed daemon, Python 2.6. Take that with a grain of salt, as I found 3.0 was fast enough for my needs.