timeit module for comparing the performance of two scripts

Phoe6 orsenthil at gmail.com
Tue Jul 11 11:52:31 EDT 2006


Fredrik Lundh wrote:
>
> $ python -m timeit -s "import pyConfig" "pyConfig.pyConfig()"
> $ python -m timeit -s "import pyConparse" "pyConparse.pyConParse()"

> note that timeit runs the benchmarked function multiple times, so you may want
> to remove the print statements.

Thanks a lot Fredrik!. I did not know that timeit runs benchmarked
function multiple times. I got scared with multiple prints and thought
import pyConfig has put it in infinite loop and I had killed the
program.

I could use Timer function as well.

Thanks,
Senthil




More information about the Python-list mailing list