[Python-Dev] Idle speed freak looking for trouble?

Fredrik Lundh fredrik@pythonware.com
Sat, 27 Oct 2001 23:21:56 +0200


I wrote:

> python 1.5: 1.02 seconds
> python 2.0: 1.95 seconds
> python 2.1: 1.85 seconds
> python 2.2: 1.90 seconds

doh.  forgot to disable GC for 2.0 and later.  with GC switched
off, the difference is a bit smaller.

python 1.5: 1.02 seconds
python 2.0: 1.30 seconds
python 2.1: 1.20 seconds
python 2.2: 1.05 seconds

now replace [None, None, None] with [item, item, item]:

python 1.5: 0.58 seconds
python 2.0: 0.85 seconds
python 2.1: 0.69 seconds
python 2.2: 0.71 seconds

playing with other dosomething bodies (and with GC switched
off), I've noticed that the following things has gotten slower
from 1.5.2 to 2.2:

- concatenating strings (item+item+item is 20% slower)
- calling the float builtin using global lookup (20% slower)
- list and tuple forming using locals (10-20% slower)

</F>