POV-Ray : Newsgroups : povray.newusers : "include" file designs : Re: "include" file designs Server Time
31 Jul 2024 02:22:01 EDT (-0400)
  Re: "include" file designs  
From: Warp
Date: 21 Feb 2003 05:47:05
Message: <3e5603a9@news.povray.org>
Will W <wil### [at] nospamwizzardsnet> wrote:
> Am I correct in assuming that there are benefits in reduced overhead in
> using this kind of approach in my own include files?

  Yes, there will be reduced overhead.
  For example, each time you #declare something in an include file, some
memory will be allocated and the memory block initialized with some data.
Depending on how many #declares (and other things) you do in the include
file, this can save more or less resources. Surrounding the include with
the multiple inclusion check avoids these allocations and other overhead.

> Also, would the following lines in myStuff.inc be worthwhile:

> #ifdef(Colors_Inc_Temp)
>     // do nothing, since colors.inc has already been called at least once
> #else
>     #include "colors.inc"
> #end

  This is the optimal way of reducing parsing overhead.
  If the #ifdef check is inside the include file, the include file will
still be opened and parsed through (POV-Ray must find the #end corresponding
to the #ifdef at the beginning and this is possible only by parsing the
whole file).
  However, doing it like you write above, the include file is not even
opened, much less parsed, which saves parsing time (specially if the include
file is large). Thus it's the optimal optimization.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

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