python : timeit - Tool for measuring execution time

Ganesh Pal ganesh1pal at gmail.com
Tue Apr 21 23:31:22 EDT 2015


Hi Team,

Iam running the below command on Linux machine have Python 2.7
installed , I was trying to figure out the speed difference between
xrange and range functions.


range :

python -m timeit 'for i in range(1000000):' ' pass'
10 loops, best of 3: 90.5 msec per loop


$ python -m timeit 'for i in xrange(1000000):' ' pass'
10 loops, best of 3: 51.1 msec per loop


Iam not able to understand what  why only 10 loops were run ? what
does this mean and how  does this work ?


Regards,
Ganesh



More information about the Python-list mailing list