www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/28/08:31:29

From: nikki AT gameboutique DOT co (nikki)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Loop unrolling: Don't bother
Date: 28 Feb 1997 07:29:48 GMT
Organization: GameBoutique Ltd.
Lines: 21
Message-ID: <5f61hc$nkg@flex.uunet.pipex.com>
References: <5f5knj$cho AT freenet-news DOT carleton DOT ca>
NNTP-Posting-Host: www.gameboutique.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

> 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 */
> }

hardly a great surprise seeing as the loop above would quite probably fit in
the cache when well optimised, but unrolled would thrash it horribly.
unrolling loops won't save an enormous amount of time, after all a jump
instruction will only take you 3 or 4 cycles at most.

nik

-- 
Graham Tootell           
nikki AT gameboutique DOT com  

- Raw text -


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