POV-Ray : Newsgroups : povray.general : coding question--position of #if block in SDL Server Time
26 Nov 2024 18:24:26 EST (-0500)
  coding question--position of #if block in SDL (Message 1 to 4 of 4)  
From: Kenneth
Subject: coding question--position of #if block in SDL
Date: 28 Jan 2010 11:05:01
Message: <web.4b61b48bec0a930165f302820@news.povray.org>
A very basic computing question, which I don't know the answer to, sorry to say.

Suppose I have a gigantic scene file, with lots of #includes, etc. Plus an #if
block at the very end:

#declare A = 1; // a boolean value
#include .....
#include .....
#include .....
.........
.........
.........
.........
.........
#if(A)
--do something--
#else
#end
--end of scene file---

I'm not a software engineer or a full-blown programmer, so my question (actually
two) concerns the scene's parse time:
1) When the #if is finally 'processed', does POV-Ray (or any coding language)
have to search back through the entire code to find A?
2) If so, would the scene parse faster if the #if block was nearer to the
#declared A?

#declare A = 1;
#if(A)
--do something--
#else
#end
#include .....
#include .....
#include .....
.........
.........
.........
.........
.........
--end of scene file---

Perhaps the #includes muddy the issue, but I'm mostly concerned about the
fastest ordering of elements in general.

Ken


Post a reply to this message

From: Warp
Subject: Re: coding question--position of #if block in SDL
Date: 28 Jan 2010 12:42:37
Message: <4b61cc8d@news.povray.org>
Kenneth <kdw### [at] earthlinknet> wrote:
> 1) When the #if is finally 'processed', does POV-Ray (or any coding language)
> have to search back through the entire code to find A?

  No.

> 2) If so, would the scene parse faster if the #if block was nearer to the
> #declared A?

  No.

-- 
                                                          - Warp


Post a reply to this message

From: Jim Holsenback
Subject: Re: coding question--position of #if block in SDL
Date: 28 Jan 2010 12:45:30
Message: <4b61cd3a@news.povray.org>
> I'm not a software engineer or a full-blown programmer,

I'm not the former ... some would debate that I'm even the later

> two) concerns the scene's parse time:
> 1) When the #if is finally 'processed', does POV-Ray (or any coding 
> language)
> have to search back through the entire code to find A?
> 2) If so, would the scene parse faster if the #if block was nearer to the
> #declared A?

don't think it matters, as after the scene file has passed the parse phase 
and read into memory, variables are referenced by a pointer to it's location 
in memory not a sequential search of the memory.

Jim


Post a reply to this message

From: Kenneth
Subject: Re: coding question--position of #if block in SDL
Date: 28 Jan 2010 13:10:01
Message: <web.4b61d232e37cd96a65f302820@news.povray.org>
Thanks to both of you.  That answers a long-standing question I've had--not just
concerning #if's, but coding in general.

My only 'real' experience with programming is quite antidiluvian--back in the
days of Hollerith cards(!) in college--much of which I've forgotten. POV-Ray and
the newsgroups have *vastly* expanded my knowledge!!

Ken


Post a reply to this message

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