[Python-Dev] Optimizing list.sort() by checking type in advance
Greg Ewing
greg.ewing at canterbury.ac.nz
Tue Oct 11 00:40:02 EDT 2016
Elliot Gorokhovsky wrote:
> I ran the
> benchmark a couple of times and the numbers seem to exactly line up
> something like one in five times; perhaps not that crazy considering
> they're executing nearly the same code?
Could this be a result of a time being measured in seconds
somewhere and then divided down?
> *** 1e7 ints + 1 float (to disable the optimization while keeping the precheck)***
> F.fastsort(): 7.57237982749939
> F.sort(): 7.666172504425049
This result looks a bit suspicious too -- it's hard to see
how fastsort could be faster even when the optimisation
is not being used.
--
Greg
More information about the Python-Dev
mailing list