Sunday, August 7, 2011

Measuring Python code execution time

import time

timestart = time.time()
# code to measure here
print time.time() - timestart, "seconds"

You can also try time.clock(). It is said to be more accurate.

No comments:

Post a Comment