Re: question about efficiency of fortran in parallel environments



C used to be provably slower than Fortran, just on theoretical grounds.
That is, it was possible to write compilers for Fortran that could
regularly make optimizations that simply could not be applied to
the corresponding C code. Of course, not all Fortran compilers
made full use of these possibilities. So, it has always been true
that an occasional really good C implementation might beat
the occasional really bad Fortran on corresponding code.

Some of this you could code around by writing the optimizations
yourself (forcing a given code order by making it explicit in C, for
example). This had the disadvantage that different optimizations
may be better on different platforms and your hand optimized C
would have to be rewritten as you port.

Fortran's default behavior is to allow the compiler more flexibility
while C's default behavior (and, until the C99 standard, the *only*
way) does not. With modern C is is possible to carefully write code
that matches Fortran for the "optimizability" of your program. However,
most C (or C++, etc.) programmers still don't use such techniques and
those compilers that recognize the new features may still not fully
optimize based upon them.

All of this ignores the more subjective issues of programming style
that Rich Maine mentioned.

--
J. Giles

"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare



.



Relevant Pages

  • Re: Casting malloc
    ... If he can make a strong case for the diagnostics, ... Uh, again, Fortran is a better tool for some sorts of work. ... familliar what Fortran compilers only in the code they generate; ... Given a variety of hard problems, Fortran consistently came up much faster with default code and no explicit optimizations. ...
    (comp.lang.c)
  • Re: Speed Test between C and Fortran 95
    ... >> Fortran compilers have done these optimizations since time immemorial ... > I think many CompSci departments would claim that Fortran actually comes from ... write kick-ass optimizers for their own compilers? ...
    (comp.lang.fortran)
  • Re: Optimizing product by 2
    ... What kind of optimizations are particular to Fortran compilers vs, ... If an entity includes POINTER ...
    (comp.lang.fortran)
  • Re: Optimizing product by 2
    ... What kind of optimizations are particular to Fortran compilers vs, ... If aliasing is possible much more ...
    (comp.lang.fortran)
  • Re: Surprise
    ... Compilers were *obviously* not portable, ... Fortran ... stance on pointers more seriously. ... no deficiencies and the other way is to make it so complicated ...
    (comp.lang.fortran)