benchmarks and questions for new python programmer

Brian Gough bjg at network-theory.co.uk
Mon May 17 03:54:36 EDT 2004


demarchi at duke.edu (stormslayer) writes:

> Note that I didn't fiddle overmuch with any of the programs -- each
> one took about 15 minutes to bang out on the keyboard.  I'm hoping
> that there is some obvious mistake in the way I used something in
> python to account for the speed differential.  It seems like a really,
> really nice language, but orders of magnitude slower than C/C++ and a
> 5x slowdown over Perl seems abusive...

In general Perl and Python should have roughly the same performance.

There is a profiler included with the standard Python distribution.
You can use it on any script from the command-line,

 $ python /usr/lib/python<version>/profile.py yourscript.py

with the appropriate path for <version> on your system.  It should
show where your program is spending all its time.  See the Python
Library Reference Manual for details of the profiler.

-- 
Brian Gough

Network Theory Ltd,
Publishing the Python Manuals --- http://www.network-theory.co.uk/



More information about the Python-list mailing list