• Tim Peters's avatar
    Gave this a facelift: "/" vs "//", whrandom vs random, etc. Boosted · 8b6ec79b
    Tim Peters authored
    the default range to end at 2**20 (machines are much faster now).
    Fixed what was quite a arguably a bug, explaining an old mystery:  the
    "!sort" case here contructs what *was* a quadratic-time disaster for
    the old quicksort implementation.  But under the current samplesort, it
    always ran much faster than *sort (the random case).  This never made
    sense.  Turns out it was because !sort was sorting an integer array,
    while all the other cases sort floats; and comparing ints goes much
    quicker than comparing floats in Python.  After changing !sort to chew
    on floats instead, it's now slower than the random sort case, which
    makes more sense (but is just a few percent slower; samplesort is
    massively less sensitive to "bad patterns" than quicksort).
    8b6ec79b
sortperf.py 4.14 KB