Template-Toolkit performance tuning

2001-12-30 Thread Ryan Thompson


Hello again,

Thanks for all the good replies on the template issue. I had forgotten
how much of a powder-keg that subject was... lucky nobody lit a match
:-)

Anyways, I've re-written one of my modules using TT to try it out, but
I am less than satisfied with the performance... To the point where I
think I may have missed an important step. Here's the details:

The template I'm testing uses about 10
[% IF variable %]Do something with $variable[% END %]
type of blocks. Nothing horribly complex.

With my previous template system, with the same logic, I could serve
on the order of 50 requests per second on the same system. Doing a
straight conversion, I'm seeing only 7.5 requests per second under TT
for the same content. Ugh! Help!

Here's a snipped of what I've done:

use Template;

my %vars;

$var{foo} = bar;   # About 30 scalars like this
.
.

my $tt = new Template({INTERPOLATE = 1});
$tt-process($file, \%vars);

Everything displays fine, and no errors/warnings show up... It's just
horribly slow. At ~150ms per request, the delay is noticeable on our
local LAN.

Without delving deeper than I already have into the documentation, I
suspect that the template files are not being cached, resulting in a
disk hit on every request. Not good! There must be a way around this.

Any thoughts?

Thanks,
- Ryan

-- 
  Ryan Thompson [EMAIL PROTECTED]
  Network Administrator, Accounts

  SaskNow Technologies - http://www.sasknow.com
  #106-380 3120 8th St E - Saskatoon, SK - S7H 0W2

Tel: 306-664-3600   Fax: 306-664-1161   Saskatoon
  Toll-Free: 877-727-5669 (877-SASKNOW) North America




Re: Template-Toolkit performance tuning

2001-12-30 Thread Bill Moseley

At 05:17 PM 12/30/01 -0600, Ryan Thompson wrote:
   use Template;

   my %vars;

   $var{foo} = bar;   # About 30 scalars like this
   .
   .

   my $tt = new Template({INTERPOLATE = 1});

Cache your template object between requests.


-- 
Bill Moseley
mailto:[EMAIL PROTECTED]



Re: Template-Toolkit performance tuning

2001-12-30 Thread perrin

At Sun, 30 Dec 2001 16:39:47 -0800 , Bill Moseley [EMAIL PROTECTED] wrote: 

At 05:17 PM 12/30/01 -0600, Ryan Thompson wrote:
  use Template;

  my %vars;

  $var{foo} = bar;   # About 30 scalars like this
  .
  .

  my $tt = new Template({INTERPOLATE = 1});

Cache your template object between requests.

Yes, you are not using caching at all if you create a new Template object on each 
request.  And turn on disk-caching as well.  And use the new XS code option if you can.

You might want to move your questions over to the Template Toolkit list for more 
specific and detailed help.

- Perrin