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.
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/