Skip to content

Instantly share code, notes, and snippets.

@gfx
Created July 30, 2010 04:00
Show Gist options
  • Select an option

  • Save gfx/499871 to your computer and use it in GitHub Desktop.

Select an option

Save gfx/499871 to your computer and use it in GitHub Desktop.
diff --git a/lib/Template/Benchmark/Engines/TextMicroTemplate.pm b/lib/Template/Benchmark/Engines/TextMicroTemplate.pm
index 756421c..a4b1051 100644
--- a/lib/Template/Benchmark/Engines/TextMicroTemplate.pm
+++ b/lib/Template/Benchmark/Engines/TextMicroTemplate.pm
@@ -150,7 +150,7 @@ sub benchmark_functions_for_memory_cache
my $t = Text::MicroTemplate::File->new(
include_path => [ $template_dir ],
escape_func => undef,
- use_cache => 1,
+ use_cache => 2,
);
$t->render_file( $_[ 0 ], { %{$_[ 1 ]}, %{$_[ 2 ]} } );
},
@@ -161,7 +161,19 @@ sub benchmark_functions_for_instance_reuse
{
my ( $self, $template_dir, $cache_dir ) = @_;
- return( undef );
+ my $t;
+ return( {
+ TeMT =>
+ sub
+ {
+ $t ||= Text::MicroTemplate::File->new(
+ include_path => [ $template_dir ],
+ escape_func => undef,
+ use_cache => 2,
+ );
+ $t->render_file( $_[ 0 ], { %{$_[ 1 ]}, %{$_[ 2 ]} } );
+ },
+ } );
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment