[Python-Dev] Silly little benchmark

Skip Montanaro skip@pobox.com (Skip Montanaro)
Tue, 10 Jul 2001 17:58:04 -0500


    Tim> Note that Windows Python has an excellent clock() function (it's
    Tim> real time, not user time, and has better than microsecond
    Tim> resolution).

Real time doesn't mean much on an operating system that can juggle multiple
tasks, no matter how quiescent you try to make it.

Okay, so here are some hopefully more comparable numbers.  I cvs up'd both
Python 1.6 (release16 tag) and Python 2.1 (release21-maint tag) directories,
reconfigured, executed make clean, then ran make and make install.  The
optimization/debug flags were the default: "-g -O2".  Both were compiled
with gcc 2.96.0.48mdk, the version of gcc that comes with Linux Mandrake
8.0.

Using the xrange(N) version:

    % python1.6 -S skip.py
    pass          0.090  0.090  0.090
    x=1           0.110  0.120  0.120
    x=``1`+`2``   1.080  1.070  1.060

    % python2.1 -S skip.py
    pass          0.090  0.100  0.090
    x=1           0.110  0.120  0.110
    x=``1`+`2``   1.700  1.680  1.700

Using the [None]*N version:

    % python1.6 -S skip.py
    pass          0.070  0.070  0.080
    x=1           0.100  0.110  0.100
    x=``1`+`2``   1.040  1.030  1.040

    % python2.1 -S skip.py
    pass          0.070  0.080  0.070
    x=1           0.110  0.100  0.100
    x=``1`+`2``   1.680  1.690  1.690

So, my observations about loop overhead were almost certainly artifacts of
differences in the way the two interpreters were compiled.  My apologies for
that flub.  It still appears there's a big slowdown between 1.6 and 2.1 in
the back tic operations though.

Aside: Tim, can I assume by your return address that Digital Creations
finally gave you an office and you're not computing from some seedy motel
room on US 1? ;-)

-- 
Skip Montanaro (skip@pobox.com)
(847)971-7098