[Python-Dev] Silly little benchmark

Skip Montanaro skip@pobox.com (Skip Montanaro)
Mon, 9 Jul 2001 23:14:01 -0500


I don't know what motivated me to try this, but based on the 

    print ``1`+`2``

thing that came up in c.l.py I came up with the following "benchmarks":

    for i in xrange(100000): pass
    for i in xrange(100000): x = 1
    for i in xrange(100000): x = ``1`+`2``

user mode times on my computer (sys mode was always 0.0) were

		   Python 1.6	       Python 2.1	  change
    pass	   0.12		       0.20		  1.67x
    x = 1	   0.17		       0.30		  1.76x
    x = ``1`+`2``  1.60		       2.13		  1.33x

Startup times (python -S -c 'pass') are 0.0 for both versions on my 'puter.
It appears loop execution overhead has gotten substantially worse between
1.6 and 2.1.  I know new stuff that will affect looping is going into 2.2
(the generator stuff), but it would seem a good time to reserve a minor
version for mostly performance improvements.  2.3 perhaps?

Or do we wait for Armin's magic pixie dust to sprinkle down upon our heads
so we can crush those Perl swine once and for all? ;-)

at-least-on-linux-ly y'rs,

Skip