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);

The sources.list reads:

  deb ftp://ftp.tw.debian.org/debian lenny main

The output from perl Makefile.PL is:

  *** Module::AutoInstall version 1.03
  *** Checking for Perl dependencies...
  [Core Features]
  - Catalyst                                   ...loaded. (5.7014 >= 5.7010)
  - Catalyst::Controller                       ...loaded. (0)
  - Catalyst::Action::RenderView               ...loaded. (0.08 >= 0.04)
  - Catalyst::Plugin::ConfigLoader             ...loaded. (0.21 >= 0.14)
  - Catalyst::Plugin::Static::Simple           ...loaded. (0.20 >= 0.20)
  - Catalyst::Plugin::Prototype                ...loaded. (1.33 >= 1.33)
  - Catalyst::Plugin::Session                  ...loaded. (0.19 >= 0.14)
  - Catalyst::Plugin::Session::Store::FastMmap ...loaded. (0.05 >= 0.02)
  - Catalyst::Plugin::Session::State::Cookie   ...loaded. (0.09 >= 0.07)
  - Catalyst::Plugin::Unicode                  ...loaded. (0.8 >= 0.2)
  - Catalyst::View::PNGTTGraph                 ...loaded. (0.02 >= 0.02)
  - Catalyst::View::TT                         ...loaded. (0.27 >= 0.25)
  - Catalyst::View::Download                   ...loaded. (0.04 >= 0.04)
  - Data::Page                                 ...loaded. (2.00 >= 2.00)
  - Date::Calc                                 ...loaded. (5.4 >= 5.4)
  - Date::Formatter                            ...loaded. (0.09 >= 0.09)
  - Date::Manip                                ...loaded. (5.54 >= 0.04)
  - DBI                                        ...loaded. (1.607 >= 1.57)
  - FindBin                                    ...loaded. (1.49 >= 1.47)
  - HTML::FormatText                           ...loaded. (2.04 >= 2.04)
  - HTML::TreeBuilder                          ...loaded. (3.23 >= 3.23)
  - MIME::Entity                               ...loaded. (5.420 >= 5.420)
  - Module::Install                            ...loaded. (0.75 >= 0.68)
  - Template                                   ...loaded. (2.20 >= 2.19)
  - Template::Plugin::Date                     ...loaded. (2.77 >= 2.77)
  - Template::Plugin::HtmlToText               ...loaded. (0.03 >= 0.02)
  - Time::Local                                ...loaded. (1.18 >= 1.17)
  - YAML                                       ...loaded. (0.66)
  *** Module::AutoInstall configuration finished.
  Writing Makefile for tirt

So though my modules are sufficiently recent, template processing is
extremely slow. Please help if you have faced a similar problem or have an
idea. I've attached the TT template.

-- 
Thanks and Regards,
Terence Monteiro.

DeepRoot Linux,
Ph: +91 (80) 4112 4781 / 85.

[%- summary_keys = c.config.summary_keys -%] [%- summary = c.config.summary %] [%- summary_statuses = c.config.summary_statuses -%] [%- display_statuses = c.config.display_statuses -%] [%- summary_statuses_once = c.config.summary_statuses_once -%] [%- username = c.session.username -%] [%- FOREACH key IN summary_keys %] [% END %] [% FOREACH status = summary_statuses_once; label = display_status.$status || status | ucfirst %] [% END %] [%- FOREACH key IN summary_keys %] [%- FOREACH status = summary_statuses; label = display_status.$status || status | ucfirst %] [%- END %] [%- END %] [% grand_tot = 0; FOREACH ts IN member_list; label = ts | ucfirst; IF ts == username %] [% ELSIF 'Nobody' == ts %] [% ELSE %] [% END; tot = 0; col = 0; col_tot.$col = 0; FOREACH key IN summary_keys; FOREACH stat IN summary_statuses; val = stats.$key.$ts.$stat; col_tot.$col = col_tot.$col + val; col = col + 1; tot = tot + val %] [%- ELSE %] 0 [%- END %] [%- END %] [%- END %] [% FOREACH stat IN summary_statuses_once; val = stats.once.$stat.$ts; tot = tot + val; col_tot.$col = col_tot.$col + val; col = col + 1 %] [%- END %] [% IF tot %] [% ELSE %] [% END; grand_tot = grand_tot + tot; END %]
Users[% summary.$key.title %][% label %]Total
[% label %]
My
Unowned
[% label %] [% IF val %] [% val %] [% IF val > 0 %] [% val %] [%- ELSE %] 0 [%- END %] [% tot %][% tot %]
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to