This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients brett.cannon, fijall, ned.deily, pitrou, serhiy.storchaka, steven.daprano, tim.peters, vstinner
Date 2016-09-21.15:28:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAMpsgwakA79=Vjf616vtdJOnE5yZNhPYGjFS5J_W6bPfPZqKeQ@mail.gmail.com>
In-reply-to <1474471055.77.0.613588138736.issue28240@psf.upfronthosting.co.za>
Content
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.
History
Date User Action Args
2016-09-21 15:28:29vstinnersetrecipients: + vstinner, tim.peters, brett.cannon, pitrou, ned.deily, steven.daprano, fijall, serhiy.storchaka
2016-09-21 15:28:29vstinnerlinkissue28240 messages
2016-09-21 15:28:29vstinnercreate