STINNER Victor added the comment: Serhiy Storchaka added the comment: >> * Change the default repeat from 3 to 5 to have a better distribution of >> timings. It makes the timeit CLI 66% slower (ex: 1 second instead of 600 >> ms). That's the price of stable benchmarks :-) > > For now default timeit run takes from 0.8 to 8 sec. Adding yet 5 sec makes a > user more angry.
Ah yes, I forgot that timeit uses power of 10 to have a nice looking "xxx loops". I chose to use power of 2 in the perf module to have shorter benchmarks, but powers of 2 are displayed as 2^n to remain readable. >> * Display large number of loops as power of 10 for readability, ex: "10^6" >> instead of "1000000". Also accept "10^6" syntax for the --num parameter. > > 10^6 syntax doesn't look Pythonic. And this change breaks third-party scripts > that run timeit. Do you mean scripts parsing the timeit output (stdout)? >> * Add support for "ns" unit: nanoseconds (10^-9 second) > > Even "pass" takes at least 0.02 usec on my computer. What you want to measure > that takes < 1 ns? IMO 20 ns is more readable than 0.02 usec. > I think timeit is just wrong tool for this. Even if timeit is not reliable, it *is* used to benchmark operations taking less than 1 us. > The patch also makes a warning about unreliable results output to stdout and > always visible. This is yet one compatibility break. Current code allows the > user to control the visibility of the warning by the -W Python option, and > don't mix the warning with result output. Oh, I forgot to documen this change. I made it because the old code displays a surprising ":0: " prefix. I chose to use print instead. I don't think that it's a common usage to hide the warning using -Wignore. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28240> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com