JGuizard
6/27/2016 - 9:21 AM

Time method and function execution in python with timeit

Time method and function execution in python with timeit

#FOR CODE
import timeit
timeit.timeit('"-".join(str(n) for n in range(100))', number=10000)

#FOR FUNCTIONS
from timeit import default_timer as timer

start = timer()
# ...
end = timer()
print(end - start)