Mail Archives: djgpp/1997/03/01/07:22:52
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 -