4394 shaares
The timeit
module is useful for micro benchmarks, but does not allow to measure execution time of large snippets, as it requires the code tested to fit in a string.
Hence, I went looking for a context or decorator-based solution. And I found this bug report commented by Guido van …