POV-Ray : Newsgroups : povray.pov4.discussion.general : Caching parsed code : Re: Caching parsed code Server Time
2 May 2024 20:01:10 EDT (-0400)
  Re: Caching parsed code  
From: nemesis
Date: 16 Apr 2009 00:12:13
Message: <49e6b01d@news.povray.org>
clipka wrote:
> *** Examine your scene file for macros that your scene makes heavy uses of,
> *** and copy them to your scene file!
> 
> 
> Consider the parsing times for the following code:
> 
> #include "rand.inc"
> //#macro VRand(RS) < rand(RS), rand(RS), rand(RS)> #end
> #declare R = seed(42);
> #declare i = 0;
> #while (i < 100000)
>   #declare V = VRand(R);
>   #declare i = i + 1;
> #end
> 
> On my Windows machine:
> Second line commented out: 91.907 seconds (76.843 CPU seconds)
> Second line "revived": A blasting 3.562 seconds (3.500 CPU seconds)
> 
> Thats ****** 25 TIMES FASTER ******
> just because of that single macro call.
> 
> Why? Because POV-Ray re-opens the macro's source file each and every time it is
> invoked... >_<

Friggin' insane.  Without even peeking at the code, I'm guessing the 
lack of proper scoping rules has something to do with that as #locals 
are locals in the context of files, not of macros... or am I wrong again?...

> So, standard macro libs are a good thing, but sometimes you better not #include
> but copy & paste them :P

Much better than simply having a bytecompiled language with true scoping 
rules and modules. ;)

ah, boost 1.38 finally compiled... :)

beta here we go!


Post a reply to this message

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