POV-Ray : Newsgroups : povray.text.tutorials : Tips & tricks: How speed-up calculations in loops - part II : Re: Tips & tricks: How speed-up calculations in loops - part II Server Time
23 Apr 2024 21:24:49 EDT (-0400)
  Re: Tips & tricks: How speed-up calculations in loops - part II  
From: Jonathan Wooldridge
Date: 25 May 2002 21:37:37
Message: <3cf03c61$1@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote in message
news:3ceff8e4@news.povray.org...
> Jonathan Wooldridge <jwo### [at] attbicom> wrote:
> > #local C=C-1;
> > // Do stuff with C
>
> > #local C=C-1;
> > // Do stuff with C
>
>   If you can get rid of those #locals and do only one #local C=C-10 at the
> end of the loop, better.
>

No sooner said than done!

// Script without so many locals ("Spam, spam, spam and eggs spam hasn't got
too much spam in it"...)
#local C=1000000;
#while(C)
    do_stuff( C );
    do_stuff( C - 1 );
    do_stuff( C - 2 );
    ...
    do_stuff( C - 8 );
    do_stuff( C - 9 );
    do_stuff( C - 10 );

    #local C = C - 10;
#end


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.