Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.lang.misc Subject: Re: Aggressive optimization Message-ID: <16546:Nov1605:36:2590@kramden.acf.nyu.edu> Date: 16 Nov 90 05:36:25 GMT References: <6063@lanl.gov> <9576:Nov1523:11:0990@kramden.acf.nyu.edu> <1990Nov16.022829.19283@murdoch.acc.Virginia.EDU> Organization: IR Lines: 35 In article <1990Nov16.022829.19283@murdoch.acc.Virginia.EDU> gl8f@astsun9.astro.Virginia.EDU (Greg Lindahl) writes: > In article <9576:Nov1523:11:0990@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: > >Matt pointed out that gcc did much better. > My name is spelled "Greg". Sorry, misspoke. > > gcc, however, will produce suboptimal code for > > for (j = 0;j < 100;j++) > > a[i * j] = ...; > If you forget to turn on strength reduction, you deserve what you get. I turned on strength reduction; it gets in trouble with the variable multiplication. Maybe the version here is older than yours? > >Even good Fortran > >optimizers don't do very well on moderately complex code. > I showed you code in which FORTRAN does well, and you have to > hand-optimize C to beat it. All I meant by ``don't do very well'' is that I can easily do better in machine language. We are, after all, talking about whether Fortran arrays are always as efficient as pointers (as in machine language, for instance). I didn't say anything about C. I pointed out that hand optimization only because it seemed appropriate. I also idly wondered whether there was any connection between the hand optimization thread and the pointer thread, and explicitly refused to make any philosophical comments about it. I'm still not sure what can be said in general. So your response really looks like a non sequitur, and a rather vapid one at that. ---Dan