python: slow timeit() function
The timeit()
function runs the code many times (default one million) and takes an average of the timings.
To run the code only once, do this:
t.timeit(1)
but that will give you skewed results - it repeats for good reason.
To get the per-loop time having let it repeat, divide the result by the number of loops. Use a smaller value for the number of repeats if one million is too many:
count = 1000print t.timeit(count) / count