low level optimization

Doug Gwyn gwyn at smoke.brl.mil
Tue Apr 16 07:43:46 AEST 1991


In article <andand.671719926 at cia.docs.uu.se> andand at cia.docs.uu.se (Anders Andersson) writes:
-In <1991Apr9.213601.12309 at agate.berkeley.edu> rkowen at violet.berkeley.edu (Dario Bressanini) writes:
->Just in case.... I don't want to start the usual and useless war
->C vs FORTRAN etc..,i would like to use C for my programs, but in most
->cases i tried, the Code produced by the C compiler was 2 or 3 times
->slower that the fortran code.
-  As you are probably well aware, the speed difference you noticed is very
-dependent of computer and compiler, but a few observations may be of interest:
-You cannot do much low-level optimization yourself in Fortran, right?
-So, Fortran compilers tend to have very clever optimizers, especially when
-the program does number crunching which often is quite easy to handle for an
-optimizer. 

I don't think that is the proper explanation of the observed phenomenon.
For any commercial-quality system, I would be amazed if an equally
competent implementation of nearly any algorithm in Fortran and C gave
much edge to Fortran.  The one possibility for a significant speed
difference of which I am aware is the requirement for pre-ANSI C that
all floating-point computations be performed in double precision, even
if the variables are declared as single-precision.  Standard C discards
that old requirement.



More information about the Comp.lang.c mailing list