Straw poll on Python performance (was Re: Python is far from a top performer ...)

Matthias no at spam.pls
Mon Jan 12 10:34:07 CET 2004

Peter Hansen <peter at> writes:

> This is my "straw poll" question:
>   Do you spend a "significant" amount of time actually optimizing your 
>   Python applications?  (Significant is here defined as "more than five
>   percent of your time", which is for example two hours a week in a 
>   40-hour work week.)

I was working on an image processing application and was looking for a
quick prototyping language.  I was ready to accept a 10-fold decrease
in execution speed w.r.t. C/C++.  With python+psycho, I experienced a
1000-fold decrease.

So I started re-writing parts of my program in C.  Execution speed now
increased, but productivity was as low as before (actually writing the
programs directly in C++ felt somewhat more natural).  Often it
happened that I prototyped an algorithm in python, started the
program, implemented the algorithm in C as an extension module and
before the python algorithm had finished I got the result from the
C-algorithm. :-(

I've tried numerics, but my code was mostly not suitable for
vectorization and I did not like the pointer semantics of numerics.

So my answer to the question above is NO, I don't spend significant
times optimizing python code as I do not use python for
computationally intensive calculations any more.  My alternatives are
Matlab and (sometimes) Common Lisp or Scheme or Haskell.

More information about the Python-list mailing list