[Python-Dev] Silly little benchmark
Tue, 10 Jul 2001 03:33:09 -0400
> 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
Please don't post stuff with hard tab characters (I took them out by hand so
this wasn't an unreadable mess).
> 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.
AFAIK, nothing relevant changed between 1.6 and 2.1. Anyone else? Indeed,
AFIAK, *nothing* plausibly relevant about about for-loops or xrange has
changed since 1.5 (when some general eval-loop speedups got done).
> but it would seem a good time to reserve a minor version for mostly
> performance improvements. 2.3 perhaps?
The loop speedup in 2.2 requires changes in the PVM as well as adopting the
iterator protocol. If you've got some *easy* performance improvements,
sure, but then I have to wonder why you've been holding them back <wink>.