Python is far from a top performer according to benchmark test...

David M. Cooke cookedm+news at physics.mcmaster.ca
Mon Jan 12 10:58:31 EST 2004


At some point, llothar at web.de (Lothar Scholz) wrote:

> Samuel Walters <swalters_usenet at yahoo.com> wrote in message news:<pan.2004.01.11.06.08.18.867825 at yahoo.com>...
>
>> I know very little about numeric processing, and even less about Fortran.
>> It's true that my background is in mathematics, but in *pure* mathematics
>> where pointer-based languages tend to be helpful, not hurtful.  
>
> Okay seems that you don't know a lot about compiler writing.
>
> A C compiler only knows a little bit about the context so it must
> always assume that a data inside a member can be referenced from
> another place via an alias pointer.
>
> Fortran does not have this problem so a lot of optimizations can be
> done and values can be hold in registers for a much longer time,
> resulting in much greater speed.
>
> Remember that on supercomputers a 25% spped enhancement (which a good
> fortran compiler is faster then C) can mean a few million dollars of
> saved hardware costs. The coding time is not importing compared to the
> running time. So real hard numerics are always done in Fortran.
>
> GNU Fortran is a stupid project because it translates the Fortran code
> to C.

Err, no. You're thinking of f2c. GNU Fortran uses the same backend as
the GNU C compiler, in that it translates to the same intermediate
language (sort of assembly language) on which optimizations are done.
But the C front end and the Fortran front end are separate.

The advantage of GNU Fortran is it's *portable*. It runs on everything
that GCC works on -- which is a lot. This makes a difference when
you're developing (like on my Apple iBook running Linux). And it looks
like the G95 project is humming along nicely.

> Python for hardcore numerics, even with PyNumerics, is simply a very
> bad solution.

You're not limited to pure Python.

No one's saying you must use only C, or only Fortran, or only Python.
Use the best tool for the job. Python just has the advantage that
mixing C and Fortran into it is easy. Write your big, number-crunching
code as a Fortran routine, wrap it with f2py, then add a Python script
around it to run it. Presto, no fiddling with Fortran for reading in
input files, or output files (depending on your routine). You can even
write a GUI in Python if you wish. Or add a webserver.

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca



More information about the Python-list mailing list