Timeit library give you the capability of measuring the run time of a piece of code or function. here is how to use it:
Here is the result:
import timeit
start_time = timeit.default_timer()
# code you want to evaluate
print 'Hello world!'
elapsed = timeit.default_timer() - start_time
print 'Time:',elapesd
Here is the result:
Hello world!
Time: 4.19853863036e-05
No comments:
Post a Comment