Re: Improving performance with TT2
Perrin Harkins <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.template-toolkit |
|---|---|
| Message-ID | <CAC0_be1YM3t-JCkn8qc4idMpD7+fk4bXgbKiSsD1jf25wG5O4A@mail.gmail.com> |
2012/2/19 Frédéric Buclin <[email protected]>: > We at Bugzilla are heavily using Template Toolkit to generate all our > templates dynamically. But when doing some profiling with > Devel::NYTProf, it appears that TT2 is taking most of the time when > processing a CGI script. This means that some pages can take up to ~10 > seconds to render, which is very slow. That is slow! Are you talking about actual CGI, or are you running in a persistent environment like mod_perl or FastCGI? Usually when TT2 seems slow it's because the caching of template is being defeated. You can't do as much caching when you're using CGI, but you can still use the on-disk cache. > One question comes to mind: I know TT2 pass variables by data instead of > by references, meaning that variables are copied again and again. That's only true if you call other templates with INCLUDE. If you use PROCESS, the variables are not copied. Of course you may be using them in a way that requires copying to be safe, but if you're able to switch from INCLUDE to PROCESS it will help some. Also make sure you compiled the XS stash module when you installed. - Perrin