Date: Sun, 2 Mar 1997 13:10:08 +0200 (IST) From: Eli Zaretskii To: Paul Derbyshire cc: djgpp AT delorie DOT com Subject: Re: Loop unrolling: Don't bother In-Reply-To: <5f5knj$cho@freenet-news.carleton.ca> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On 28 Feb 1997, Paul Derbyshire wrote: > 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. This really doesn't tell much, unless you post both the exact source code that you compiled, the method used to time it, and the results of the timing. Anyway, at the first glance, calling a function inside a loop will usually obscure any effect of loop unrolling, at least in my experience.