POV-Ray : Newsgroups : povray.newusers : "include" file designs : Re: "include" file designs Server Time
31 Jul 2024 02:24:31 EDT (-0400)
  Re: "include" file designs  
From: Christopher James Huff
Date: 21 Feb 2003 09:31:17
Message: <cjameshuff-22686E.09282921022003@netplex.aussie.org>
In article <3e558acf@news.povray.org>,
 "Will W" <wil### [at] NOSPAMwizzardsnet> wrote:

> However textures.inc doesn't use this approach while math.inc and shapes.inc
> use slightly different logic with the #ifndef directive to do the same thing
> (skip parsing the file if that has already been done once).

They were written at different times by different people.


> Am I correct in assuming that there are benefits in reduced overhead in
> using this kind of approach in my own include files?

Yes, this way POV doesn't have to fully parse the file and recreate all 
the variables, just find the #end of the #ifndef or #ifdef directive.


> 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
> 
> I don't see anything like this in the standard includes I have looked at,
> yet it looks like a simple extension of the idea (if POV isn't going to
> parse the file anyway, why pay the even higher cost of loading it?)

#ifndef() would work better, you don't need the empty part. But the 
benefit is very small, I was unable to measure it even on my old 
machine, and it adds dependencies to the inside of one include file to 
the other includes which could be a nightmare to maintain. Not 
worthwhile: at best you save a few milliseconds per render.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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