On Thu, Jun 07, 2007 at 01:40:47PM -0600, Josh Rosenbaum wrote:
> 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);
Ah, I saw that and thought it was passing the parameters to localize
and to save in the stash.
localize() is created at run time?
[EMAIL PROTECTED]:~/Template2$ fgrep -r 'localize' lib
lib/Template/Context.pm:# can handle INCLUDE calls: the stash will be localized.
lib/Template/Context.pm: my ($self, $template, $params, $localize) = @_;
lib/Template/Context.pm: $localize ? '<localized>' :
'<unlocalized>', ')')
lib/Template/Context.pm: if ($localize) {
lib/Template/Context.pm: unless ($localize) {
lib/Template/Context.pm: if ($localize) {
lib/Template/Context.pm: return $self->process($template, $params, 'localize
me!');
> So I'd say that the overhead for MACRO is the same as INCLUDE in regards to
> the localization.
Ok, back to the profiler. I doubt I use INCLUDE anywhere (other than
in the macro calls) so might be possible to override localize and
delocalize to do nothing and see what kind of difference that makes.
--
Bill Moseley
[EMAIL PROTECTED]
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates