POV-Ray : Newsgroups : povray.general : In case your scene parses too slow... Server Time
2 Nov 2024 15:25:34 EDT (-0400)
  In case your scene parses too slow... (Message 1 to 7 of 7)  
From: clipka
Subject: In case your scene parses too slow...
Date: 16 Apr 2009 00:10:00
Message: <web.49e6aeec231c37c2255d1edc0@news.povray.org>
.... try copying and pasting the most heavily used macros into the file they are
used in.

For instance, on my Windows XP machine the following code can be sped up to
parse *** 25 TIMES FASTER *** by un-commenting the second line:

#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 Linux machine, it's not that extreme, but still a factor of 12.


Post a reply to this message

From: Warp
Subject: Re: In case your scene parses too slow...
Date: 16 Apr 2009 11:34:57
Message: <49e75021@news.povray.org>
clipka <nomail@nomail> wrote:
> .... try copying and pasting the most heavily used macros into the file they are
> used in.

  This is actually a known phenomenon since the dawn of time. Of course
since it's not mentioned in any FAQ or documentation...

-- 
                                                          - Warp


Post a reply to this message

From: Kenneth
Subject: Re: In case your scene parses too slow...
Date: 17 Apr 2009 05:10:01
Message: <web.49e84654c058b311f50167bc0@news.povray.org>
"clipka" <nomail@nomail> wrote:
> .... try copying and pasting the most heavily used macros into the file they are
> used in.

Yep, I'm using the same scheme in an animation that I'm running--it incorporates
numerous 'generic' macros that I made, which I *could* have saved as .inc files,
but instead are part of the SDL.  Iterated over 200 animation frames, that saves
LOTS of time. I've even done the same thing with several of the mesh-generation
macros in shapes.inc.

KW


Post a reply to this message

From: Thomas de Groot
Subject: Re: In case your scene parses too slow...
Date: 17 Apr 2009 10:16:08
Message: <49e88f28$1@news.povray.org>
"clipka" <nomail@nomail> schreef in bericht 
news:web.49e6aeec231c37c2255d1edc0@news.povray.org...
> .... try copying and pasting the most heavily used macros into the file 
> they are
> used in.
>

Yes! and .inc content too of course, although less heavy generally speaking.
(Cannot be repeated enough)

Thomas


Post a reply to this message

From: CShake
Subject: Re: In case your scene parses too slow...
Date: 17 Apr 2009 21:22:59
Message: <49e92b73$1@news.povray.org>
clipka wrote:
> .... try copying and pasting the most heavily used macros into the file they are
> used in.
> 
> For instance, on my Windows XP machine the following code can be sped up to
> parse *** 25 TIMES FASTER *** by un-commenting the second line:
> 
> #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 Linux machine, it's not that extreme, but still a factor of 12.
> 
> 
> 
This is because each time a macro is called that is in a different file, 
the entire containing file is reopened, right? (I remember that from 
something in the documentation)

Thinking about that, I'd like to add 'storing macros in memory' for 
anything called more than once to the 4.0 SDL wishlist. Most other 
compliers do that as far as I know, but I do understand reasons behind 
the current behavior, since macros can be huge and all.


Post a reply to this message

From: nemesis
Subject: Re: In case your scene parses too slow...
Date: 18 Apr 2009 00:30:00
Message: <web.49e95689c058b311f83d00fc0@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> clipka <nomail@nomail> wrote:
> > .... try copying and pasting the most heavily used macros into the file they are
> > used in.
>
>   This is actually a known phenomenon since the dawn of time. Of course
> since it's not mentioned in any FAQ or documentation...

I don't know what is worse:  that it isn't mentioned or that humongous flat
scene files would be the norm was it mentioned in the docs. :P


Post a reply to this message

From: clipka
Subject: Re: In case your scene parses too slow...
Date: 18 Apr 2009 04:15:00
Message: <web.49e98b40c058b311b04f58b50@news.povray.org>
CShake <cshake+pov### [at] gmailcom> wrote:
> > For instance, on my Windows XP machine the following code can be sped up to
> > parse *** 25 TIMES FASTER *** by un-commenting the second line:
>
> This is because each time a macro is called that is in a different file,
> the entire containing file is reopened, right? (I remember that from
> something in the documentation)

Exactly.

> Thinking about that, I'd like to add 'storing macros in memory' for
> anything called more than once to the 4.0 SDL wishlist. Most other
> compliers do that as far as I know, but I do understand reasons behind
> the current behavior, since macros can be huge and all.

I would have taken for granted that if POV 4.0 SDL would operate on bytecode
basis, *all* macros of included files would reside in memory.

But I guess it would also be possible to first compile any files encountered
into bytecode files (unless the compiled files already exist and are
up-to-date), and then load macros from there, using some invocation counter to
decide whether to unload a macro again after use or keep it in memory.


Post a reply to this message

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