Message 278907 - Python tracker (original) (raw)

I'm disappointed by the discussion on minumum vs average. Using the perf module (python3 -m perf timeit), it's very easy to show that the average is more reliable than the minimum. The perf module runs 20 worker processes by default: with so many processes, it's easy to see that each process has a different timing because of random address space layout and the randomized Python hash function.

Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-09-21 15:17

Serhiy: "This makes hard to compare results with older Python versions."

Serhiy is right. I see two options: display average and minimum (which can be confusing for users!) or display the same warning than PyPy:

"WARNING: timeit is a very unreliable tool. use perf or something else for real measurements"

But since I'm grumpy now, I will now just close the issue :-) I pushed enough changes to timeit for today ;-)