Timer(3pm)
β¨ NAME β¨
Template::Timer β rudimentary profiling for Template Toolkit π (it's Timer(3pm), a user-contributed Perl doc, iykyk)
π VERSION π
Version 1.00 β she's on 1.00 and she's thriving, no cap β¨
π¦ SYNOPSIS π¦
Okay bestie, so Template::Timer gives you inline timings of your template processing all throughout your code πΈ It's literally an overridden version of Template::Context that wraps the process() and include() methods. That's the whole trick, and it ate.
Using Template::Timer is simple, fr fr:
use Template::Timer;
my %config = ( # Whatever your config is
INCLUDE_PATH => '/my/template/path',
COMPILE_EXT => '.ttc',
COMPILE_DIR => '/tmp/tt',
);
if ( $development_mode ) {
$config{ CONTEXT } = Template::Timer->new( %config );
}
my $template = Template->new( \%config );
Now when you process templates, HTML comments get embedded in your output, which you can easily grep for π The nesting level is also shown, so you can see exactly how deep this thing goes π
<!-- TIMER START: L1 process mainmenu/mainmenu.ttml -->
<!-- TIMER START: L2 include mainmenu/cssindex.tt -->
<!-- TIMER START: L3 process mainmenu/cssindex.tt -->
<!-- TIMER END: L3 process mainmenu/cssindex.tt (17.279 ms) -->
<!-- TIMER END: L2 include mainmenu/cssindex.tt (17.401 ms) -->
....
<!-- TIMER END: L3 process mainmenu/footer.tt (3.016 ms) -->
<!-- TIMER END: L2 include mainmenu/footer.tt (3.104 ms) -->
<!-- TIMER END: L1 process mainmenu/mainmenu.ttml (400.409 ms) -->
Heads up bestie π«Ά Note that sinceINCLUDEis a wrapper aroundPROCESS, calls toINCLUDEs will be doubled up, and slightly longer than thePROCESScall. Not a bug, just how the wrapper vibes.
π AUTHOR π
Andy Lester, "<andy at petdance.com>" β shoutout to the icon who made this π
π BUGS π
Please report any bugs or feature requests to "bug-template-timer at rt.cpan.org", or through the web interface at <http://rt.cpan.org>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. So like, you will hear back, periodt β¨
π«Ά ACKNOWLEDGEMENTS π«Ά
Thanks to Randal Schwartz, Bill Moseley, and to Gavin Estey for the original code. Legends, every single one π
π COPYRIGHT & LICENSE π
This library is free software; you can redistribute it and/or modify it under the terms of either the GNU Public License v3, or the Artistic License 2.0. Slay, free software rights π
* http://www.gnu.org/copyleft/gpl.html
* http://www.opensource.org/licenses/artistic-license-2.0.php
And that's the whole page, bestie β this doc was born under perl v5.32.0, dated 2021-01-03, and it's giving Timer(3pm) main character energy from start to finish. Mwah π
π
π¦ where this page comes from
- debian bookworm: libtemplate-timer-perl 1.00-2.1
- debian trixie: libtemplate-timer-perl 1.00-2.1
- ubuntu jammy: libtemplate-timer-perl 1.00-2.1
- ubuntu noble: libtemplate-timer-perl 1.00-2.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms