Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!spool.mu.edu!uunet!tnc!m0154 From: m0154@tnc.UUCP (GUY GARNETT) Newsgroups: comp.sys.amiga.programmer Subject: Re: FORTRAN on the Amiga Message-ID: <744@tnc.UUCP> Date: 5 Mar 91 16:08:29 GMT References: <2412@ria.ccs.uwo.ca> Reply-To: m0154@tnc.UUCP (GUY GARNETT) Organization: The Next Challenge, Fairfax, Va. Lines: 40 [Why a FORTRAN compiler might produce faster code than a C compiler] I presume that the programs in question are some sort of scientific software that does some heavy number crunching (the kind of work that FORTRAN has traditionally done). Now, FORTRAN compilers have been around a long time (much longer than C) and are used for crunchy problems where small efficencies count a lot. I would expect that the complier has very good optimizing routines for the kind of code FORTRAN is likely to be used for, and given how long FORTRAN has been around, I would expect that the optimizer algorithm has every trick in the trade, and then some. Since most of these calculations involve floating-point math, I would also expect a great deal of time and effort to be spent optimizing the heck out of the floating-point library. C seems to be designed for manipulating data structures, and I would expect the kinds of optimizations made by a C compiler to be different than those made by a FORTRAN number cruncher. In addition, I think that the C floating-point routines are given less priority, and are therefore not as highly efficient as the FORTRAN ones. On the other hand, if a classic C program was ported to FORTRAN (assuming that it could even be done) I would expect it to run much slower in FORTRAN than in the original. On the IBM mainframe I use at work, the FORTRAN compiler (IBM VS FORTRAN) can generally produce smaller and faster code than most assembly language coders; this is because the comiler has information on *ALL* the instruction modes and quirks (more than most programmers can remember), and analyses more different options for the code than most programmers have time for (it can even re-arrange your program, moving entire chunks of code, for greater efficency). On this system, writing fast code means writing your program so that the FORTRAN compiler can tell what it is you are trying to do, and then letting the compiler figure out the best way to do it. Wildstar Mild-Mannered IBM 3090 Programmer by day ... ... Wild-Eyed Amiga Fanatic by Night