|
|
> >
> > One of the oldest tricks known, loop unrolling, should speed up as
well.
>
> Nobody likes unrolling 1000000 iterations ;-)
>
Loop unrolling isn't about coding every iteration, for that very reason.
Doing an unroll of a loop reduces the number of passes for the loop.
If you have a million iterations, then there is some overhead for each of a
million passes through the loop.
You can reduce this by a factor of ten, by unrolling the loop ten times
within the loop.
Try timing this:
// Unrolled Script
#local C=1000000;
#while(C)
#local C=C-1;
// Do stuff with C
#local C=C-1;
// Do stuff with C
#local C=C-1;
// Do stuff with C
#local C=C-1;
// Do stuff with C
#local C=C-1;
// Do stuff with C
#local C=C-1;
// Do stuff with C
#local C=C-1;
// Do stuff with C
#local C=C-1;
// Do stuff with C
#local C=C-1;
// Do stuff with C
#local C=C-1;
// Do stuff with C
#end
Post a reply to this message
|
|