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: 2 Sep 2014 18:47:06 GMT
  Re: Tips & tricks: How speed-up calculations in loops - part II  
From: Warp
Date: 11 Feb 2002 12:43:27
W³odzimierz ABX Skiba <abx [at] babilonorg> wrote:
: Nobody likes unrolling 1000000 iterations ;-)

  That's not what loop unrolling means.
  It means that you take a divisor of the number of loops to perform and
"unroll" the body of the loop that many times and decrease the loop index by
that amount.
  That is, if your loop is something like:

#declare Ind = 1000000;
#while(Ind)
  do_something()
  #declare Ind = Ind-1;
#end

you convert it to something like:

#declare Ind = 1000000;
#while(Ind)
  do_something()
  do_something()
  do_something()
  do_something()
  do_something()
  do_something()
  do_something()
  do_something()
  do_something()
  do_something()
  #declare Ind = Ind-10;
#end

  This should parse faster.

-- 
#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

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