Python is darn fast (was: How fast is Python)

Van Gale news at exultants.org
Sat Aug 23 23:59:51 EDT 2003


Michele Simionato wrote:
> I posted this few weeks ago (remember the C Sharp thread?) but it went
> unnoticed on the large mass of posts, so let me retry. Here I get Python+
> Psyco twice as fast as optimized C, so I would like to now if something
> is wrong on my old laptop and if anybody can reproduce my results.
> Here are I my numbers for calling the error function a million times
> (Python 2.3, Psyco 1.0, Red Hat Linux 7.3, Pentium II 366 MHz):
> 
> $ gcc erf.c -lm -o3

Did you really use "-o3" instead of "-O3"?  The lowercase -o3 will 
produce object code file named "3" instead of doing optimization.

Also, code optimization with gcc really seems to be a black art.  It's 
just very application and machine specific as many Gentoo Linux users 
are discovering.  For instance "-Os" can be much faster than "-O[23]" 
for some applications run on machines that have fast CPU's with low 
cache.  It also seems that -O2 is faster in many cases than -O3 :/

Regardless, if psyco can speed things up to even unoptimized C range 
that's pretty impressive.

Van





More information about the Python-list mailing list