From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: speed of compiled programms Date: 4 Sep 2001 19:20:27 GMT Organization: Aachen University of Technology (RWTH) Lines: 25 Message-ID: <9n39hr$jr8$1@nets3.rz.RWTH-Aachen.DE> References: <80o7ptk35260gn4l05obuh0du6k37psstq AT 4ax DOT com> <2p1aptcsq4ra5m2vb0mor7553fcbipv50l AT 4ax DOT com> NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 999631227 20328 137.226.32.75 (4 Sep 2001 19:20:27 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 4 Sep 2001 19:20:27 GMT Originator: broeker@ To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Marco Vienup wrote: >>How much slower? Can you give numbers? > Hm, I have a simple timeout for(...) construct. > for(int i=0; i<=500;i++){ one small if(...) } > If it is the fast code, it will run in a timeout, with > the slow code the maximum is 100-120. You could be a bit more precise. The precise nature of that "one small if()", and the exact set of compiler switches, along with the compiler version might well be needed to reproduce the behaviour you observed. It may also be helpful if you run gcc with the compiler switch -save-temps added, and then look at (or show us) the difference in the *.s files generated that way, for the different optimization levels. From a more general point of view, -O3 was indeed known to slow down code rather than speed them up, for several programs, and several versions of GCC. That's because the main difference between -O3 and -O2 used to be the -finline optimization switch, which tends to deteriorate the performance on architectures tuned for optimal execution of loops such as the x86 platform. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.