Re: Improving performance with TT2

Perrin Harkins <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.template-toolkit
Message-ID <CAC0_be0+4JAu-T2z7yY6ebNzvE1LjR=P=hJrVu1N=Ae896o41Q@mail.gmail.com>
On Sun, Feb 19, 2012 at 4:20 PM, Perrin Harkins <[email protected]> wrote:
> [ Please keep replies on the list. ]
>
> 2012/2/19 Frédéric Buclin <[email protected]>:
>> Le 19. 02. 12 21:57, Perrin Harkins a écrit :
>>> That is slow!  Are you talking about actual CGI, or are you running in
>>> a persistent environment like mod_perl or FastCGI?
>>
>> Bugzilla supports both modes: mod_cgi and mod_perl. For instance,
>> https://bugzilla.mozilla.org uses mod_perl, but there are many
>> installations around the world still using mod_cgi.
>
> Ok.  For mod_perl, you should take care to keep your Template object
> around between requests, so that it can use the same cache.  That
> makes a huge difference.
>
> For CGI (and this won't hurt mod_perl either), you should set
> COMPILE_EXT and COMPILE_DIR.  More here:
> http://tt2.org/docs/modules/Template.html#section_Caching_and_Compiling_Options
>
> If that isn't enough to make CGI performance decent, you'll probably
> have to consider using a different template module.  CGI is an extreme
> case and most template systems will perform badly when they can't
> cache between requests.  Text::MicroTemplate is probably your best bet
> under CGI.
>
>> Is there a better tool than Devel::NYTProf to debug TT? It seems to
>> return wrong line numbers when looking at templates.
>
> It's probably giving you line numbers of the compiled templates, not
> the original template source.  If you turn on the compile cache
> options I mentioned above you'll be able to look at the files it
> compiles from your templates and the line numbers will make more
> sense.
>
> - Perrin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.