[Python-Dev] 3.3 str timings

Stefan Behnel stefan_ml at behnel.de
Tue Aug 21 20:38:18 CEST 2012

Xavier Morel, 21.08.2012 19:56:
> On 21 août 2012, at 19:25, Steven D'Aprano wrote:
>> On 21/08/12 23:04, Victor Stinner wrote:
>>> I don't like the timeit module for micro benchmarks, it is really 
>>> unstable (default settings are not written for micro benchmarks).
>> [...]
>>> I wrote my own benchmark tool, based on timeit, to have more stable 
>>> results on micro benchmarks: 
>>> https://bitbucket.org/haypo/misc/src/tip/python/benchmark.py
>> I am surprised, because the whole purpose of timeit is to time micro 
>> code snippets.
> And when invoked from the command-line, it is already time-based: unless
> -n is specified, python guesstimates the number of iterations to be a
> power of 10 resulting in at least 0.2s per test (the repeat defaults to
> 3 though)
> As a side-note, every time I use timeit programmatically, it annoys me
> that this behavior is not available and has to be implemented manually.

+100, sounds like someone should contribute a patch for this.


More information about the Python-Dev mailing list