timeit module for comparing the performance of two scripts

Fredrik Lundh fredrik at pythonware.com
Tue Jul 11 11:40:35 EDT 2006


"Phoe6" <orsenthil at gmail.com> wrote:

> How do I compare the performance of pyConfig.py vs pyConparse.py using
> timeit module?

$ 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.

</F> 






More information about the Python-list mailing list