Splitting lists

Steven Taschuk staschuk at telusplanet.net
Thu Feb 27 20:25:02 EST 2003


Quoth Alex Martelli:
  [...]
> Interestingly, my numbers are a bit different:
> 
> [alex at lancelot logs]$ python2.3 -O ti.py
> viktor1           1.06   1.06
  [...]
> This isn't a particularly hi-end machine -- it's a 1.2 GHz Athlon
> PC with DDR 2100 RAM and Linux Mandrake 9.0, reasonably cheap even
> when I bought it almost two years ago.  [...]

Ah, my machine's age is showing.  (How embarrassing!)  I'll see
your 1.2 GHz Athlon bought two years ago and raise you a 233 MHz
Pentium II bought three and a half years ago.

Of course, the more informative statistic is the ratios:

                        Steven           Alex           Viktor
    viktor1           1.00   0.96     1.00   1.00     1.00   0.97
    viktor2           0.90   0.87     0.74   0.73     0.71   0.69
    viktor2lookup     0.63   0.60     0.62   0.58     0.64   0.61
    viktor3           1.26   1.48     1.25   1.49     1.29   1.64
    duncan            0.91   0.89     0.76   0.75     0.72   0.69
    duncanlookup      0.63   0.60     0.66   0.63     0.63   0.59
    alex              0.68   0.65     0.67   0.66     0.64   0.62

All agree on the broad comparisons:
	1. viktor2lookup, duncanlookup, alex
	2. viktor2, duncan
	3. viktor1
	4. viktor3

I imagine that more detailed comparisons are unsound: even
ignoring the hardware differences, we're all using different
versions of Python, Viktor isn't running Linux, and you and I are
probably using different versions of kernel, libraries, etc..

> Anyway, on my machine "viktor2lookup" -- the simplest approach,
> except that the append bound methods are looked up into local
> variables just once before the loop -- is repeatably fastest
> on this particular test.

As here.

-- 
Steven Taschuk                  staschuk at telusplanet.net
"Telekinesis would be worth patenting."  -- James Gleick





More information about the Python-list mailing list