[SciPy-dev] Sorting speed

Travis Oliphant oliphant.travis at ieee.org
Sat Dec 31 20:29:18 CST 2005

Robert Kern wrote:

>My (limited) understanding is that timsort is specifically optimized
>for sorting Python lists as they are generally used. Thus, compare
>operations are minimized because comparison operations are potentially
>expensive for general Python objects where they are relatively very
>cheap for numeric arrays. Also, timsort scans for runs, so sorting a
>list that is entirely sorted except for the last item is quite fast.
>Since one can append to lists, this is very useful for lists, but one
>cannot append to arrays so it would be less useful to us. The benefits
>of adopting timsort are probably less than they were for Python lists.
That was my impression as well after looking at the code for a bit.  
I've moved on.


More information about the Scipy-dev mailing list