how fast is Python?

Irmen de Jong irmen at
Thu Aug 21 10:14:00 CEST 2003

Alex Martelli wrote:
> Irmen de Jong wrote:

>>Investigate Psyco. There was one example on this
>>newsgroup that showed that Python+psyco actually
>>outperformed the same program in compiled C.
> I think (but will gladly stand corrected if I'm wrong!) that
> this is a misinterpretation of some code I posted -- the
> C code (crazily) used pow(x,2.0), the Python one (sanely)
> x*x -- within a complicated calculation of erf, and that
> one malapropism in the C code was what let psyco make
> faster code than C did.  With C fixed to use x*x -- as any
> performance-aware programmer will always code -- the
> two ran neck to neck, no advantage to either side.

Whoops, I missed that :) Thanks for the clarification.

Nevertheless, a Psyco-optimized piece of Python code
that runs as fast as compiled C is still very impressive
to me. I know that JIT compiler technology theoretically
could produce better optimized code than a static optimizing
compiler, but am happy already if it reaches equal level :-)

--Irmen de Jong

More information about the Python-list mailing list