On 2007-12-06, Neil Cerutti <[EMAIL PROTECTED]> wrote: > It should beat ResortEverything consistently once the lists > become larger than a certain size. Do you get better results at > all with the above function?
With psyco, my merge_sorted becamse faster than relying on timsort at roughly 80 elements total. Without psyco it was always slowest. Both were much faster than the ASPN imerge recipe--if you built a list with the result. imerge is wicked fast if you never extract any values, though. ;-) Or perhaps I'm just misprofiling. I used: a = range(20000) # e.g b = range(17000) t = timeit.Timer('merge_sorted(a, b)', 'from __main__ import ' 'merge_sorted, a, b') t2 = timeit.Timer('merge_sorted2(a, b)', 'from __main__ import ' 'merge_sorted2, a, b') t3 = timeit.Timer('list(imerge(a, b))', 'from __main__ import imerge, a, b') print t.timeit(100) print t2.timeit(100) print t3.timeit(100) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list