Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!uupsi!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: low level optimization Message-ID: <15828@smoke.brl.mil> Date: 15 Apr 91 21:43:46 GMT References: <1991Apr9.213601.12309@agate.berkeley.edu> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 21 In article andand@cia.docs.uu.se (Anders Andersson) writes: -In <1991Apr9.213601.12309@agate.berkeley.edu> rkowen@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.