[Python-bugs-list] [ python-Bugs-474992 ] python version benchmark

noreply@sourceforge.net noreply@sourceforge.net
Sat, 27 Oct 2001 20:25:46 -0700


Bugs item #474992, was opened at 2001-10-25 11:43
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=474992&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Frederic Giacometti (giacometti)
Assigned to: Nobody/Anonymous (nobody)
Summary: python version benchmark

Initial Comment:

This is not a bug per se, but following instructions by
Tim Peters the One :), I'm submitting here the
benchmark script.

I'm getting currently the following final output
(bench.txt):

version   bench1    nogc  bench2
1.5.2        0 %
2.0         48 %    33 %    21 %
2.1.1       53 %    35 %    25 %
2.2         51 %    35 %    23 %

where:

bench1 = original python 1.5.2 script 
nogc = bench1 when disabling gc
bench2 = bench1 script 'rewritten' for python 2.0 and
latter (string methods, sre -> pre...)

These numbers are high...

Frederic Giacometti

----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-10-27 20:25

Message:
Logged In: YES 
user_id=31435

And more from effbot:

"""
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)
"""

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-10-27 20:24

Message:
Logged In: YES 
user_id=31435

Useful info from the effbot:

"""
fwiw, here's the timings I get on a slow windows box (using
PythonWare builds, and time.clock() instead of os.times()):

python 1.5: 2.01
python 2.0: 3.02
python 2.1: 3.00
python 2.2: 3.04

after playing some more, I ended up with this little 
benchmark:

def dosomething(item):
    return [None, None, None]

data = [None] * 100000

import time
t1 = time.clock();
x = map(dosomething, data)
t2 = time.clock()
print t2 - t1

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

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=474992&group_id=5470