A better self

Delaney, Timothy tdelaney at avaya.com
Wed Jul 24 20:36:56 EDT 2002


> From: Terry Reedy [mailto:tjreedy at udel.edu]
> 
> "Michael Chermside" <mcherm at destiny.com> wrote in message
> news:mailman.1027533340.29544.python-list at python.org...
> >      # A program to sort lines. Takes, as command-line argument, a
> ...
> > But all of these are dwarfed (for large file sizes... let's say 1 GB
> of
> > text) by the fact that you are running a REALLY FAST sort algorithm.
> 
> Few of us appreciate the days that Tim Peters spent writing a portable
> sort program that is significantly better than standard quicksort for
> several classes of input (such as a sorted list with new items
> appended to the end).  He is currently working on another that may be
> even better.  (Three horn toots for Tim.)

That latest figures are *most* impressive. *No* categories of data (random,
partially-ordered, etc) where there is a significant slowdown, most
categories have a performance improvement, and it's a stable sort to boot.
And he says that he can get a bit more improvement in a couple of cases ...
(without special-casing mind you).

I'm really looking forward to timsort replacing samplesort :)

> > Of course, you could code the same sort algorithm in C yourself.
> 
> Hmm.  How many of us have both the skill and patience to develop and
> test such a delicate and complex algorithm tweaked for various special
> cases -- and apparently release it bug free (Tim says there has never
> been a report of the current sort malfunctioning).

And timsort manages to remove most of the special cases that samplesort was
testing for. Of course, he claims the source of timsort is just as hairy and
convoluted as samplesort ...

Tim Delaney




More information about the Python-list mailing list