POV-Ray : Newsgroups : povray.text.tutorials : Tips & tricks: How speed-up calculations in loops - part II Server Time
1 Nov 2024 21:59:28 EDT (-0400)
  Tips & tricks: How speed-up calculations in loops - part II (Message 11 to 13 of 13)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Warp
Subject: Re: Tips & tricks: How speed-up calculations in loops - part II
Date: 25 May 2002 23:02:45
Message: <3cf05055@news.povray.org>
Jonathan Wooldridge <jwo### [at] attbicom> wrote:
>     do_stuff( C );
>     do_stuff( C - 1 );
>     do_stuff( C - 2 );
>     ...
>     do_stuff( C - 8 );
>     do_stuff( C - 9 );
>     do_stuff( C - 10 );

  You are doing 11 things there, not 10.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From:
Subject: Re: Tips & tricks: How speed-up calculations in loops - part II
Date: 27 May 2002 04:13:11
Message: <cgq3fu4kn246bn60l5f038rl8nc6uk0tkb@4ax.com>
On Sat, 25 May 2002 18:38:58 -0700, "Jonathan Wooldridge"
<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


Post a reply to this message

From: Jonathan Wooldridge
Subject: Re: Tips & tricks: How speed-up calculations in loops - part II
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

<<< Previous 10 Messages Goto Initial 10 Messages

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