delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/01/07:22:52

From: "Sly" <sly AT aussie DOT net>
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 <ao950 AT FreeNet DOT Carleton DOT CA> 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)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019