How long does my Python application take to run?
To get the best result on different platforms:
from timeit import default_timer as timer# START MY TIMERstart = timer()code for applicationmore codemore codeetc# STOP MY TIMERelapsed_time = timer() - start # in seconds
timer()
is a time.perf_counter()
in Python 3.3 and time.clock()/time.time()
in older versions on Windows/other platforms correspondingly.