|
![](/i/fill.gif) |
Hi all.
Let's say I've made a macro, and that I use it in the usual way in my scene (by
invoking it numerous times with different variables.) But let's say I also need
to invoke the same macro hundreds of times *without* changing the variables (in
a #while loop for example.) Forget for the moment what the macro actually does;
I have a question about what would be the most computationally-efficient way to
invoke the macro in such a case.
Here's the way I would normally do it (this is a very simplistic example, just
to illustrate the idea):
#declare counter = 1;
#while(counter <= 200)
my_macro(1,2,3) // the same variables each time
#declare counter = counter + 1;
#end
Would it be more efficient to instead pre-#declare the macro with those set
variables, before using it in the #while loop? As in...
#declare my_identical_macro = macro(1,2,3);
Then using *that* in the #while loop. (Which does work, BTW.)
When #pre-declared this way, is there just one 'instance' of the macro now
(similar to calling a pre-#declared triangle mesh hundreds of times), making the
process faster and more efficient? Or is the macro repeatedly computed anyway,
like it normally would be?
Ken
Post a reply to this message
|
![](/i/fill.gif) |