Python too slow for real world

Ivan Van Laningham ivanlan at callware.com
Mon Apr 26 17:15:42 EDT 1999


Pythonistas--

Roy Smith wrote:
> 
> I hope this doesn't sound as bad as I fear it might, but part of being a
> good programmer (or at least a good computer scientist) is to understand
> performance issues like this.
> 
> Regular expression theory hasn't changed a whole bunch in the last 20
> years; it's the same stuff in C, Perl, and any other language that has RE
> functionality (either built-in or through some library).  The idea of
> factoring constant operations out of loops is the same today is it was 10,
> 20, 30 years ago.
> 
> If you don't know that RE's get compilied (and that the compilation stage
> can be expensive), you don't understand the tool you're using.  If you
> don't understand that factoring the expensive constant compilation process
> out of a loop is important to make your program run fast, you aren't a
> good programmer.  No programming language can help that.
> 

Roy, you're absolutely right.  However, the person who originally posted
the question (and I'm sorry, but I've forgotten who) was speaking from a
newbie's viewpoint.  Stuff that most of us on the list take for granted
is not always obvious to someone who is new both to the language and to
the field in general.  And, things that are obvious in C or C++ or some
other language are not always obvious when moving to a new language, and
some idioms simply don't exist in some languages.  Look at the questions
posted the other day by the person who wanted to know how to do things
in Python that he had to do all the time in C++ ... it was just not
obvious to him that those were neither necessary nor desirable in
Python.

In sum, I think tips on how to optimize source code need to be part of
the introductory documentation of any language; not everyone has gone to
school and learned these things in Pascal 101, and even if they have
there are idioms that won't translate.

<if-python-were-pascal-we'd-all-be-in-trouble>-ly y'rs,
Ivan
----------------------------------------------
Ivan Van Laningham
Callware Technologies, Inc.
ivanlan at callware.com
http://www.pauahtun.org
See also: 
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps:  Cu Chi, Class of '70
----------------------------------------------




More information about the Python-list mailing list