[Python-Dev] Optimizing list.sort() by checking type in advance

Nathaniel Smith njs at pobox.com
Mon Oct 10 16:53:19 EDT 2016


On Mon, Oct 10, 2016 at 1:42 PM, Elliot Gorokhovsky
<elliot.gorokhovsky at gmail.com> wrote:
> *** 10 strings ***
> F.fastsort(): 1.6689300537109375e-06
> F.sort(): 1.6689300537109375e-06

I think something has gone wrong with your timing harness...

For accurately timing microbenchmarks, you should use timeit, or
better yet Victor Stinner's perf package:
  https://perf.readthedocs.io/

-n

-- 
Nathaniel J. Smith -- https://vorpus.org


More information about the Python-Dev mailing list