POV-Ray : Newsgroups : povray.advanced-users : macro question Server Time
5 Jul 2024 15:28:57 EDT (-0400)
  macro question (Message 4 to 13 of 13)  
<<< Previous 3 Messages Goto Initial 10 Messages
From: Jim Charter
Subject: Re: macro question
Date: 22 Feb 2008 17:35:02
Message: <47bf4e16$1@news.povray.org>
Charles C wrote:
> I've been working with the assumption that an occasional call to an 
> #included macro containing tight loop calling a second macro in the same 
> #include file many times should be fairly efficient, based I think on 
> posted tests from back-when and what Warp said again just now.
> Charles
Yeah, that would seem right, but that is the solution I didn't want to 
use only because it would result in redundant copies of a macro that I 
wrote precisely to isolate reusable code.  Oh well, it is really more 
about design aesthetics than parse time anyway.

I wonder if it would make a difference if the whole thing was wrapped in 
a macro.  I'll try some tests.


Post a reply to this message

From: David Wallace
Subject: Re: macro question
Date: 24 Mar 2008 15:24:40
Message: <47E80E1A.7070608@earthlink.net>
Jim Charter wrote:
> Charles C wrote:
>> I've been working with the assumption that an occasional call to an 
>> #included macro containing tight loop calling a second macro in the 
>> same #include file many times should be fairly efficient, based I 
>> think on posted tests from back-when and what Warp said again just now.
>> Charles
> Yeah, that would seem right, but that is the solution I didn't want to 
> use only because it would result in redundant copies of a macro that I 
> wrote precisely to isolate reusable code.  Oh well, it is really more 
> about design aesthetics than parse time anyway.
> 
> I wonder if it would make a difference if the whole thing was wrapped in 
> a macro.  I'll try some tests.

My parametric surface builder uses a macro in an included file to define the 
shape.  The #include code is in the parametric macro itself (called once), but 
the included macro is called thousands of times on occasion (once per vertex). 
I have noticed some lag if the grid is 100x100 or more.

What inefficiencies are involved with this type of process?

-- 
--------------
David Wallace
TenArbor Consulting
"Just In Time Cash"
www.tenarbor.com
1-866-572-CASH


Post a reply to this message

From: Alain
Subject: Re: macro question
Date: 25 Mar 2008 09:30:00
Message: <47e90c68$1@news.povray.org>
David Wallace nous apporta ses lumieres en ce 2008/03/24 16:24:
> Jim Charter wrote:
>> Charles C wrote:
>>> I've been working with the assumption that an occasional call to an 
>>> #included macro containing tight loop calling a second macro in the 
>>> same #include file many times should be fairly efficient, based I 
>>> think on posted tests from back-when and what Warp said again just now.
>>> Charles
>> Yeah, that would seem right, but that is the solution I didn't want to 
>> use only because it would result in redundant copies of a macro that I 
>> wrote precisely to isolate reusable code.  Oh well, it is really more 
>> about design aesthetics than parse time anyway.
>>
>> I wonder if it would make a difference if the whole thing was wrapped 
>> in a macro.  I'll try some tests.
> 
> My parametric surface builder uses a macro in an included file to define 
> the shape.  The #include code is in the parametric macro itself (called 
> once), but the included macro is called thousands of times on occasion 
> (once per vertex). I have noticed some lag if the grid is 100x100 or more.
> 
> What inefficiencies are involved with this type of process?
> 
When you use a macro from an #include, that file is loaded every time the macro 
is parsed. Open the file, read from the file, close the file. This take time, 
even if the file is cached in memory.
It would be beter is you put that macro into your code, or at least, in the same 
file as the calling macro.
#Called_Macro[macro stuff]
#Calling_Macro[some macro stuff..Called_Macro(...)..more macro stuff}

-- 
Alain
-------------------------------------------------
   The other day I came home and a guy was jogging, naked. I asked "Why?"  He 
said "Because you came home early."
	Rodney Dangerfield


Post a reply to this message

From: Jim Charter
Subject: Re: macro question
Date: 27 Mar 2008 01:33:47
Message: <47eb3fcb$1@news.povray.org>
Alain wrote:

> When you use a macro from an #include, that file is loaded every time 
> the macro is parsed. Open the file, read from the file, close the file. 
> This take time, even if the file is cached in memory.
> It would be beter is you put that macro into your code, or at least, in 
> the same file as the calling macro.
> #Called_Macro[macro stuff]
> #Calling_Macro[some macro stuff..Called_Macro(...)..more macro stuff}
> 

Yes, in my case I want to use the Colefax spline macros which are 
packaged as an include file.  The macros are called mega times to 
retrieve spline points and build a mesh.  If I cut and paste the macros 
into my include file which contains my macros which call them, I cut the 
parse time by a factor of four or five.  If I leave them in their own 
include file, the parse time is degraded no matter where I insert the 
#include statement.


Post a reply to this message

From: Warp
Subject: Re: macro question
Date: 27 Mar 2008 05:08:38
Message: <47eb7226@news.povray.org>
Jim Charter <jrc### [at] msncom> wrote:
> If I cut and paste the macros 
> into my include file which contains my macros which call them

  That sounds like a bad idea.

-- 
                                                          - Warp


Post a reply to this message

From: Jim Charter
Subject: Re: macro question
Date: 27 Mar 2008 19:12:24
Message: <47ec37e8$1@news.povray.org>
Warp wrote:
> Jim Charter <jrc### [at] msncom> wrote:
> 
>>If I cut and paste the macros 
>>into my include file which contains my macros which call them
> 
> 
>   That sounds like a bad idea.
> 
Well I'm certainly open to suggestions.


Post a reply to this message

From: Warp
Subject: Re: macro question
Date: 27 Mar 2008 19:18:20
Message: <47ec394b@news.povray.org>
Jim Charter <jrc### [at] msncom> wrote:
> Warp wrote:
> > Jim Charter <jrc### [at] msncom> wrote:
> > 
> >>If I cut and paste the macros 
> >>into my include file which contains my macros which call them
> > 
> > 
> >   That sounds like a bad idea.
> > 
> Well I'm certainly open to suggestions.

  Maybe you didn't get my reference. Let me rephrase:

Jim Charter <jrc### [at] msncom> wrote:
> If I cut and paste the macros

  That sounds like a bad idea.

  ;)

-- 
                                                          - Warp


Post a reply to this message

From: Jim Charter
Subject: Re: macro question
Date: 27 Mar 2008 20:40:46
Message: <47ec4c9e$1@news.povray.org>
Warp wrote:
> Jim Charter <jrc### [at] msncom> wrote:
> 
>>Warp wrote:
>>
>>>Jim Charter <jrc### [at] msncom> wrote:
>>>
>>>
>>>>If I cut and paste the macros 
>>>>into my include file which contains my macros which call them
>>>
>>>
>>>  That sounds like a bad idea.
>>>
>>
>>Well I'm certainly open to suggestions.
> 
> 
>   Maybe you didn't get my reference. Let me rephrase:
> 
> Jim Charter <jrc### [at] msncom> wrote:
> 
>>If I cut and paste the macros
> 
> 
>   That sounds like a bad idea.
> 
>   ;)
> 
The only other option I can think of is to call my include with its 
macros from within the Colefax include, probably slightly less subject 
to errors, but not much cleaner in any other regard.


Post a reply to this message

From: Arttu Voutilainen
Subject: Re: macro question
Date: 28 Mar 2008 10:04:40
Message: <47ed0908@news.povray.org>
Jim Charter wrote:
> Warp wrote:
>> Jim Charter <jrc### [at] msncom> wrote:
>>
>>> Warp wrote:
>>>
>>>> Jim Charter <jrc### [at] msncom> wrote:
>>>>
>>>>
>>>>> If I cut and paste the macros into my include file which contains 
>>>>> my macros which call them
>>>>
>>>>
>>>>  That sounds like a bad idea.
>>>>
>>>
>>> Well I'm certainly open to suggestions.
>>
>>
>>   Maybe you didn't get my reference. Let me rephrase:
>>
>> Jim Charter <jrc### [at] msncom> wrote:
>>
>>> If I cut and paste the macros
>>
>>
>>   That sounds like a bad idea.
>>
>>   ;)
>>
> The only other option I can think of is to call my include with its 
> macros from within the Colefax include, probably slightly less subject 
> to errors, but not much cleaner in any other regard.

You still didn't get it. Warp doesn't like "cut & paste", he thinks it 
should be "copy & paste"...



-- Arttu Voutilainen


Post a reply to this message

From: Warp
Subject: Re: macro question
Date: 28 Mar 2008 10:28:59
Message: <47ed0ebb@news.povray.org>
Arttu Voutilainen <bli### [at] removethiszbxtnetinvalid> wrote:
> You still didn't get it. Warp doesn't like "cut & paste", he thinks it 
> should be "copy & paste"...

  No, "cut & paste" is ok, *if you are realling cutting*, not copying.
That is, you press ctrl-x. or whatever the shortcut is for "cut".

  However, more often than not, doing that is a bad idea.

-- 
                                                          - Warp


Post a reply to this message

<<< Previous 3 Messages Goto Initial 10 Messages

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