On 15 September 2016 at 09:57, Victor Stinner <victor.stin...@gmail.com> wrote:
> 2016-09-15 10:02 GMT+02:00 INADA Naoki <songofaca...@gmail.com>:
>> In my environ:
>> ~/local/python-master/bin/python3 -m timeit -s "d =
>> dict.fromkeys(range(10**6))" 'list(d)'
> Stooooop! Please stop using timeit, it's lying!
> * You must not use the minimum but average or median
> * You must run a microbenchmark in multiple processes to test
> different randomized hash functions and different memory layouts
> In short: you should use my perf module.
Made essentially no difference to the results I posted:
>py -3.5 -m perf timeit -s "d = dict.fromkeys(range(10**6))" -- "list(d)"
Median +- std dev: 21.4 ms +- 0.7 ms
>py -3.6 -m perf timeit -s "d = dict.fromkeys(range(10**6))" -- "list(d)"
Median +- std dev: 20.0 ms +- 1.1 ms
3.6 remains faster, by very little (barely one standard deviation).
I would consider that the same result as timeit (to the level that
it's reasonable to assign any meaning to a microbenchmark).
Python-Dev mailing list