On Fri, 2005-09-09 at 14:07 -0700, Praveen Ray wrote:
> use Time::HiRes qw(gettimeofday tv_interval);
Better to use the Benchmark module for this. It looks like you only run
each one once. A few hundred iterations would give more stable results.
> sub render_tt2
> {
> my ($data) = @_;
> my $o_tt2 = Template->new({
> ABSOLUTE => 1,
> });
> my $templ = _read_chunk('tt_template');
> my $filename = tmpnam();
> open (F, ">$filename");
> print F $templ;
> close F;
>
> my $str;
> $o_tt2->process($filename,{data => $data},\$str);
>
> # need to process twice since first one would not use
> cached template
You could do the first one in a build_ sub, like you did for
HTML::Template.
- Perrin