[Catalyst] Slow template processing on debian lenny
Moritz Onken
onken at houseofdesign.de
Mon Sep 15 10:02:46 BST 2008
> 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.
More information about the Catalyst
mailing list