A89: Re: Question for you guys


[Prev][Next][Index][Thread]

A89: Re: Question for you guys




>
> Ok I have a question.  I have herd of "rolling out of loops" several
times,
> and have no idea what it is.  If someone could give an example of a loop
> before and after, or point me to a guide that would be helpful.
>
> Thanks in advance for any help.
>
> Matt.


I think you 're speaking about "unrolling a loop". This is very simple :
let's say that you want to call a function 10 time. You could use a loop
like this :

move.w #9,d0
loop:
 bsr function
dbra d0,loop

If your function is very small, the fact of running a loop could highly
decrease your program performances. Now there is a method to make this
faster : "unrolling" the loop. Very simple, the above code become :

bsr function
bsr function
bsr function
bsr function
.... (ten time)

That's that, the loop is "unrolled". Since we don't have a loop the code
runs faster, on the other hand it size have increased.




References: