Fortran vs. C for numerical work

Richard Harter rh at smds.UUCP
Sat Nov 24 17:57:35 AEST 1990


In article <21884 at orstcs.CS.ORST.EDU>, ghe at comphy.physics.orst.edu (Guangliang He) writes:
> In article <BGLENDEN.90Nov21003342 at mandrill.cv.nrao.edu> bglenden at mandrill.cv.nrao.edu (Brian Glendenning) writes:

> It may not be true any more. A friend of mine brought a little fortran
> program (It is two big do loops with some instrinsic function calculation in
> the loop.) and the C translation of the fortran program. We compiled two
> program on a IBM RISC System 6000/530 with xlc and xlf. To my surprise, the
> excutable from C is faster than the excutable from Fortran by a few percent.

This probably has nothing to do with the merits of C versus Fortran and
has everything to do with the merits of the compilers involved.  In the
UNIX world C compilers are often optimized to a gnats posterior whereas
Fortran compilers are often relatively primitive.  The converse is true
in environments where Fortran is big and C is just another minor language.

Fundamentally Fortran compilers can be faster because the Fortran language
specification forbids aliasing (but makes the user responsible for 
making sure that it is not present) whereas C has to deal with it.
-- 
Richard Harter, Software Maintenance and Development Systems, Inc.
Net address: jjmhome!smds!rh Phone: 508-369-7398 
US Mail: SMDS Inc., PO Box 555, Concord MA 01742
This sentence no verb.  This sentence short.  This signature done.



More information about the Comp.lang.c mailing list