New to Python: Features

beliavsky at aol.com beliavsky at aol.com
Tue Oct 26 13:28:02 EDT 2004


aleaxit at yahoo.com (Alex Martelli) wrote in message news:<1gl6fnk.m1zq7z1fm0nhbN%aleaxit at yahoo.com>...
 
> > No, no, I want the C speed.
> 
> Then use C: no other portable language (including C++ when properly
> used) quite matches C's speed across the board.

I doubt this assertion -- Fortran is portable and is easier to
optimize than C, in part because pointers are used less.

> Good programmers
> realize that "premature optimization is the root of all evil in
> programming" and choosing a language based on the speed of its
> implementations is the ultimate _premature_ optimization, of course;
> they code in a powerful high-level language, then, iff more speed is
> needed in some (typically tiny) corner of an application, recode that
> part, only (e.g. in pyrex, a mostly Python-like language which
> interoperates smoothly with Python and does "compile down to C").  

Good programmers are busy and may not want to write a program in a
relatively slow language when they know will have to rewrite it later.
Fortran 95 and Python with Numeric or Numarray are comparably high
level languages, but Fortran has a performance edge of 2-100 in the
tests I have run (several posted to comp.lang.python). According to
the Pyrex web site http://nz.cosc.canterbury.ac.nz/~greg/python/Pyrex/
the latest version is 0.9.3 -- this version number implies that Pyrex
is not mature. Fortran 95 compilers are mature. Nowadays, applications
where performance is critical are often run on Linux clusters (often
of AMD Opteron processors), and Fortran compiler vendors are
supporting these platforms. Are Pyrex and other Python projects being
customized in this way?

> If you don't need portability, C's speed isn't optimal anyway; psyco (a
> just-in-time optimizer for Python) can sometimes beat C by going
> directly to machine language (but it only works for intel and compatible
> CPUs, not for example for the PowerPC chips used in Apple's Mac
> computers -- that is the downside, of course).

There are optimizing Fortran 95 compilers for Intel Windows, Intel
Linux, AMD Opteron on Linux, PowerPC etc., listed at
http://www.dmoz.org/Computers/Programming/Languages/Fortran/Compilers/
. You are conceding that Python is less portable if you demand
performance. There is even a free, fast compiler called G95 for these
platforms -- see http://www.g95.org .



More information about the Python-list mailing list