Bill Moseley wrote:
Ok, back to premature optimization for a second...

I'm using macros quite a bit these days.  It's often
noted that it's more efficient to use PROCESS over INCLUDE due
to the localization of INCLUDE.

IIRC, MACRO only localizes the variables passed in, right?

I think that is wrong. Here's a snippet of complied code for a macro. (From a 
previous email of yours actually :) [Subject: Process vs Macro]).

my $stash = $context->localise($params);
eval {
 #line 0 "input file handle"
 $output .=  ("Var is '" . $stash->get('var') . "'\n");
};
$stash = $context->delocalise();

The stash appears to be completely localized right there. The params are just 
included in the new stash.

Template::Context::localise calls $self->{ STASH }->clone(@_);
Template::Stash::clone creates a copy of the stash. (At least in the version I 
checked.)

So I'd say that the overhead for MACRO is the same as INCLUDE in regards to the 
localization.

-- Josh

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to