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
5 May 2024 12:30:27 EDT (-0400)
  Re: Tips & tricks: How speed-up calculations in loops - part II  
From: Jonathan Wooldridge
Date: 28 May 2002 20:52:00
Message: <3cf42630$1@news.povray.org>
<jwo### [at] attbicom> wrote:
> > 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
>
> Are you aware that calling macro usually isn't faster than perform float
> #local in current pov parser ?
>
> ABX

The do_stuff( x - y) statements are place holders, they are not meant to
represent an additional macro call. Think of them as pseudo-code, in order
to discuss the topic. If you had planned to execute a sphere{} instruction a
million times, then replace the do_stuff statements with sphere{} statements
TEN times (for the last guy who pointed out an off-by-one error).

As far as performance between declaring a variable, and calling a macro, I
haven't written anything to test that out.


Post a reply to this message

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