Andy Lester wrote:
>
> We're doing this, and it's working marvelously.  Now, what else can I
> do
> to speed things up?  Heck, I'd settle for rudimentary profiling to see
> which of the templates is dragging our server down the most.
>

You can use a Template::Context subclass to insert timing comments in the
HTML.

Just overried what class is used:
$Template::Config::CONTEXT = 'TimingContext';

package TimingContext;
use base qw( Template::Context );
use Time::HiRes qw( gettimeofday tv_interval );
foreach my $sub (qw( process include )) {
    *$sub = sub {
        my $self     = shift;
        my $template = ref $_[0] ? $_[0]->name : $_[0];
        my $start    = [gettimeofday];
        my $data     = eval "\$self->SUPER::$sub([EMAIL PROTECTED])";
        my $elapsed  = tv_interval($start);
        return "<!-- START: $template -->\n$data\n<!-- END: $template
($elapsed seconds) -->";
    };
}
1;

Gavin.



_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to