POV-Ray : Newsgroups : povray.newusers : Parsing Q : Re: Parsing Q Server Time
29 Jul 2024 06:27:39 EDT (-0400)
  Re: Parsing Q  
From: Florian Brucker
Date: 29 May 2006 10:34:26
Message: <447b0672$1@news.povray.org>
> 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

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