[Templates] Processing templates from variables
Paul Seamons
mail@seamons.com
Tue, 7 Aug 2007 10:23:15 -0600
On Tuesday 07 August 2007 10:01 am, Randal L. Schwartz wrote:
> >>>>> "Pronichev" == Pronichev Alexander <dyker@agava.com> writes:
>
> Pronichev> Thanks a lot, this is what I was looking for.
>
> Although I would suggest you rethink that. Whenever you use "eval", you
> are compiling the template from scratch. All of the nice caching (in
> memory and disk) provided by TT is thrown away, so your performance will
> suffer, perhaps drastically.
In Template::Alloy (drop in replacement for Template) - the strings are cached
via MD5 - there is little performance hit to using eval. Even without the
MD5 caching the compiling is a bit faster in Template::Alloy. This is
similar to what Text::Tmpl does. Using MD5 signatures for eval'ed strings
and string refs passed to process has been discussed before in previous
threads - I'm hoping the feature will be in TT3.