From: "Sly" Newsgroups: comp.os.msdos.djgpp Subject: Re: Loop unrolling: Don't bother Date: 28 Feb 1997 05:16:23 GMT Organization: Sly Lines: 30 Message-ID: <01bc252e$b1edb440$82081ecb@sly> References: <5f5knj$cho AT freenet-news DOT carleton DOT ca> NNTP-Posting-Host: max0ppp00.bne.aussie.net To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Paul Derbyshire wrote in article <5f5knj$cho AT freenet-news DOT carleton DOT ca>... > > > I have determined that loop unrolling produces very little speed gain. > > > A loop such as > > register int i,j; > for (i=0; i<15; i++) { > /* simple arithmetic */ > for (j=0; j<21; j++) { > /* Function call and some math */ > } > /* More math */ > } > > compiled with -O3 and a manually-unrolled loop (using macros) also > compiled with -O3 don't run at appreciably different rates. > Is it possible that with the -O3 option, the compiler sees that these are indeed constant iteration loops, and unrolls them itself? Try it with -O0 option, because this should turn off all optimisation. -O3 is the highest level of optimisation available. -- TTFN Sly (Steve)