On Tue, Sep 25, 2001 at 09:02:13AM -0400, Chris Winters wrote:
> Well, most of the performance issues seem to have gone away now that I
> got caching (and compiling) working with the custom Template::Provider
> subclass in OpenInteract. Still, I'm curious if putting all the
> MACRO/BLOCK items in a file is the best way to create a common
> library.

Not really.  A MACRO is created as a closure to localise the stash,
do whatever it is that you want to do, delocalise the stash, then 
return.

So it's slightly slower than calling direct as you've got an extra 
subroutine to call and you always get localisation of variables so
you lose any benefit of doing:

   [% MACRO foo PROCESS foo %]

I suspect that the other Bad Thing is that the MACRO closures are 
being re-defined for each template you process whereas you actually 
want them created just once.

There should be a better way to do this.  Maybe a PRE_PRE_PROCESS
option to process a template(s) once when the engine fires up instead
of processing it before each template?


A



Reply via email to