+ 1

Is there a function to determine execution time in Python???

in Matlab there is a tic //commands //commands toc method for timing process's. is there something like this in Python

26th Oct 2017, 1:44 PM
reza
reza - avatar
3 Respostas
+ 3
import time start = time.time() //commands //commands end = time.time() print end - start
26th Oct 2017, 2:36 PM
Αητοιπe
Αητοιπe - avatar
+ 2
timeit is designed to smooth out execution time differences over many iterations: from timeit import timeit print( timeit('costly_func()') ) # default 100000 iterations The Windows high-resolution timer appears to be unavailable here, so accuracy is about 15.8ms # Some optional parameters: # setup='from mymodule import costly_func', number=howManyTimes
26th Oct 2017, 3:18 PM
Kirk Schafer
Kirk Schafer - avatar
0
it works thanks for your help
26th Oct 2017, 2:37 PM
reza
reza - avatar