[Python-Dev] Sorting

M.-A. Lemburg mal@lemburg.com
Fri, 26 Jul 2002 19:36:04 +0200


Tim Peters wrote:
> [MAL]
> 
>>Here's the result for AMD Athlon 1.2GHz/Linux/gcc:
>>
>>without patch:
>>
>>Python/Tim-Python> ./python -O Lib/test/sortperf.py 15 20 1
>>  i    2**i  *sort  \sort  /sort  3sort  +sort  ~sort  =sort  !sort
>>15   32768   0.08   0.01   0.01   0.09   0.01   0.03   0.00   0.09
>>16   65536   0.20   0.02   0.01   0.20   0.03   0.07   0.02   0.20
>>17  131072   0.46   0.06   0.02   0.45   0.05   0.20   0.04   0.49
>>18  262144   0.99   0.09   0.10   1.09   0.11   0.40   0.12   1.12
>>19  524288   2.33   0.20   0.20   2.30   0.24   0.83   0.19   2.47
>>20 1048576   4.89   0.40   0.41   5.37   0.48   1.71   0.38   6.22
> 
> 
> I assume you didn't read the instructions in the patch description:
> 
>     http://www.python.org/sf/587076
> 
> The patch doesn't change anything about how list.sort() works, so what
> you've shown us is the timing variance on your box across two identical
> runs.  To time the new routine, you need to (temporarily) change L.sort() to
> L.msort() in sortperf.py's doit() function.  It's a one-character change,
> but an important one <wink>.

Dang. Why don't you distribute a ZIP file which can be dumped
onto the standard Python installation ?

Here's the .msort() version:

Python/Tim-Python> ./python -O sortperf.py 15 20 1
  i    2**i  *sort  \sort  /sort  3sort  +sort  ~sort  =sort  !sort
15   32768   0.08   0.01   0.01   0.01   0.01   0.03   0.00   0.02
16   65536   0.17   0.02   0.02   0.02   0.02   0.07   0.02   0.06
17  131072   0.41   0.05   0.04   0.05   0.04   0.16   0.04   0.09
18  262144   0.95   0.10   0.10   0.10   0.10   0.33   0.10   0.20
19  524288   2.17   0.20   0.21   0.20   0.21   0.66   0.20   0.44
20 1048576   4.85   0.42   0.40   0.41   0.41   1.37   0.41   0.84

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
_______________________________________________________________________
eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...
Python Consulting:                               http://www.egenix.com/
Python Software:                    http://www.egenix.com/files/python/