> Perhaps timeit should grow a macro-benchmark tool too? I find myself often > using timeit to time macro-benchmarks simply because it's more convenient at > the interactive interpreter than the alternatives. > > Something like this idea perhaps? > > http://preshing.com/20110924/timing-your-code-using-pythons-with-statement I have essentially the same snippet (with the addition of being able to provide names for timers, thus allowing to have several executing in the code and knowing which is which) lying in my toolbox for a long time now, and I find it very useful. There's also an alternative approach, having a decorator that marks a function for benchmarking. David Beazley has one good example of this here: http://www.dabeaz.com/python3io/timethis.py Eli
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4