Python is slow?

Robert Singer rsinger at
Tue Sep 23 22:05:55 CEST 2008

On Tue, 23 Sep 2008 11:07:22 -0700 (PDT), sturlamolden
<sturlamolden at> wrote:

>On Sep 23, 3:44 pm, Robert Singer <rsinger at> wrote:
>> Well, python is not a number crunching language. However much we would
>> like it to be (we would ? :-).
>> No scripting language is.
>Not even Matlab, R, IDL, Octave, SciLab, S-PLUS or Mathematica?

No. And just to avoid eventual useless discussions which might arise,
I ment to say that *in general* compiled languages are faster. We can
always have discussions whether or not some newer scripting languages
like some from the above list, come close, but that usually is just
wasted time.

Specifically, I cannot say about R, IDL or S-PLUS, since I never used
those (not even heard of IDL till now). Octave and Mathematica have
been with me for such a short time (we had a few licences for
Wolfram's child for one year, but not my part of the company, so ...)
that I would rather not give my opinion about those.
I've used Matlab and Scilab for a longer time (still do actually -
Matlab for measurement data acquisition, and Scilab ... well, it just
sits on the disk somewhere actually), and although Matlab is quite
fast when disk I/O is involved, it still comes far.

>> Also, (I'm not that familiar with python yet, so I don't know how to
>> do it in python), try finding the bottlenecks of your calculation.
>I did use a profiler, there is no particular single bottle-neck.

You're talking about your c or your python version of the program?

There is always a bottleneck - that's just the part which works most
slowly. Try to find the part which takes the longest to execute, try
to put it differently. If it cannot be done, go to the next slowest

>Good compilers are too expensive, and gfortran is not good enough yet.
Gfortran is one of the better compilers on the market. There was, just
the other day, a nice discussion on comp.lang.fortran how it is
marvellous what a group of enthousiasts managed do in their time, what
commercial giants still didn't.
May I ask what are your main objections to it ?

Best regards

More information about the Python-list mailing list