From: Bram Stolk Newsgroups: comp.os.msdos.djgpp Subject: Re: I don't understand djgpp's optimizations Date: 7 Apr 1997 08:36:23 GMT Organization: EuroNet Internet Message-ID: <3348B1FF.167E@gig.nl> References: <33440E51 DOT 6AE AT imaginet DOT fr> <5i38mc$36q AT news DOT epcc DOT edu> <334864E0 DOT 5EDE AT cynergy DOT com DOT au> NNTP-Posting-Host: shadwell.gig.nl Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 33 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Hi, BECman wrote: > He is doing 50,000 calculations in a 'for' loop, not pausing. > I'm sure this should be in the FAQ, as it's one of the > important aspects that everyone needs. When benchmarking: Make sure, that the result of the calculations is used afterwards (in a printf or so). If you don't, a smart compiler will optimize it, and remove the calculations entirely. This is what happened to me, after writing a very naive benchmark :-) The smart compiler was Sun's cc. Bram > > Graham. -- o----------------------------------------------------------------------o | Bram Stolk, ElectroGIG, Wibautstraat 137c, 1097DN Amsterdam, Holland | | tel: +31 20 462 462 0 email: bram AT gig DOT nl home: stolk AT xs4all DOT nl | | | | "Real programmers do not comment their code -- it was hard to write, | | it should be hard to understand." | o----------------------------------------------------------------------o