Sunday, October 02, 2005

Timing a function (pytime)

Python's timing facilities are...unPythonic. Module timeit requires you to specify the number of iterations for the timing loop. But that number varies according to the speed of the machine you're running on, level of optimization of your code, etc. It's more Pythonic to calculate the number of iterations in the timing procedure. As so: (Source code).

1 comment:

Anonymous said...

Interesting, it's like in Viagra Online labs, we work with a original source, we never look for some another sources that can help us in some way.
Thanks