How to measure execution time of a program
fredrik at pythonware.com
Wed Jun 28 09:58:29 CEST 2006
Girish Sahani wrote:
> Can anyone tell me the simplest way to do it (some code snippet that
> could be included in the program's main function) ??
t0 = time.time()
print time.time() - t0, "seconds"
(assuming that you want to measure wall time, and that your program runs
for at least a tenth of second, or so. for benchmarking of short code snippets,
see the "timeit" module)
More information about the Python-list