|
![](/i/fill.gif) |
> It should be faster than real parsing isn't it?
Depends, I guess: Consider this scene:
#if (0)
#declare b = 0;
#while (b<1000000)
sphere { x*b, 0.5 pigment { rgb 1 } }
#declare b = b + 1;
#end
#else
#end
Parsing it takes 0 seconds (Because the loop is parsed, but not
executed). But if you replace the loop with actual data, like this:
#if (0)
sphere { x*0 0.5 pigment { rgb 1 } }
sphere { x*1 0.5 pigment { rgb 1 } }
sphere { x*2 0.5 pigment { rgb 1 } }
...
sphere { x*999997 0.5 pigment { rgb 1 } }
sphere { x*999998 0.5 pigment { rgb 1 } }
sphere { x*999999 0.5 pigment { rgb 1 } }
#else
#end
Parsing takes 11 seconds, because this time each sphere has to be parsed
separately.
So if you're long parsing times are caused by lengthy calculations in
loops or recursion (but are short in terms of lines of SDL), then
removing them won't really shorten parse time. But if they are caused by
"real parsing", you're better off moving that data to an include file:
#if (0)
#include "test2.pov"
#else
#end
Takes 0 seconds to parse (test2.pov contains the 10000000 sphere
definitions from above).
HTH,
Florian
Post a reply to this message
|
![](/i/fill.gif) |