[Python-ideas] Timing hefty or long-running blocks of code

Giampaolo Rodola' g.rodola at gmail.com
Wed Jun 5 13:43:33 CEST 2013


2013/6/1 Steven D'Aprano <steve at pearwood.info>:
> The timeit module is great for timing small code snippets, but it is rather
> inconvenient for timing larger blocks of code. It's also over-kill: under
> normal circumstances, there is little need for the heroic measures timeit
> goes through to accurately time long-running code.
[...]
> Is there interest in seeing this in the standard library?

A strong +1.
This is one of those things I personally need quite often.
FWIW In the 'utils' module I use across multiple projects I have a
modified version of this:
http://dabeaz.blogspot.it/2010/02/function-that-works-as-context-manager.html


--- Giampaolo
https://code.google.com/p/pyftpdlib/
https://code.google.com/p/psutil/
https://code.google.com/p/pysendfile/


More information about the Python-ideas mailing list