[Catalyst] Slow template processing on debian lenny

Terence Monteiro terence at deeproot.co.in
Fri Sep 26 13:56:16 BST 2008


Moritz Onken wrote:
> 
>> Hi,
>>
>> I've been using TT for years and enjoy the features it provides. In
>> one of
>> my Catalyst applications, I'm processing a template which generates
>> HTML to
>> give me a table with counts taken from a hash. I'm using a lot of nested
>> FOREACH to generate the table.
>>
>> On my machine, an ubuntu hardy, it works fast - about 2.5 seconds to
>> process the template. On a production server using debian lenny, it
>> used to
>> take around the same amount of time. But recently, I upgraded it to
>> libperl
>> 5.10 and updated the different Perl modules including Template and
>> Catalyst::View::TT. After this upgrade, the same template takes 25
>> seconds
>> on average to process. The times I am mentioning are the times taken
>> on the
>> server side, as shown by the Catalyst application debug logs.
>>
>> I tried to work around the problem by bypassing C::V::TT and using the
>> following code to process the template inside the controller, but to
>> no avail:
>>
>>  my $tmpl = Template->new({
>>    INCLUDE_PATH => $c->config->{home} . '/root',
>>    RELATIVE => 1
>>  });
>>  my $output = '';
>>  $tmpl->process('index.tt', { %{$c->stash}, c => $c }, \$output);
>>  $c->res->body($output);
>>
> 
> Try Template::Alloy instead. It's a fully compatible faster
> implementation of TT.
> 
> replace
>>  my $tmpl = Template->new({
>>    INCLUDE_PATH => $c->config->{home} . '/root',
>>    RELATIVE => 1
>>  });
> 
> with
> 
>>  my $tmpl = Template::Alloy->new({
>>    INCLUDE_PATH => $c->config->{home} . '/root',
>>    RELATIVE => 1
>>  });
> 
> and install Template::alloy, of course.

Thanks! Template::Alloy does the trick. Some conflict when the Template
module runs inside of Catalyst on this particular server. Nothing else
seems to work, and outside of catalyst the same template was processing
much faster with the same data. The only thing with Template::Alloy is that
it does'nt seem to support the list import vmethod, does someone have a
patch, or do I modify my template to get import working?

-- 
Thanks and Regards,
Terence Monteiro.

DeepRoot Linux,
http://www.deeproot.in
Ph: +91 (80) 4112 4781 / 84 / 85
Getting GNU/Linux to work for you. Faster. Better. Today. Every way




More information about the Catalyst mailing list