« lib/Template/Benchmark/Engines/TemplateSandbox.pm
↑ Summary
lib/Template/Benchmark/Engines/TextClearSilver.pm »
| 1 | package Template::Benchmark::Engines::TemplateTiny; | ||
| 2 | |||
| 3 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 1 | ▶ | use base qw/Template::Benchmark::Engine/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 0 | ▶ | use Template::Tiny; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 9 | |||
| 10 | our $VERSION = '1.09_01'; | ||
| 11 | |||
| 12 | our %feature_syntaxes = ( | ||
| 13 | literal_text => | ||
| 14 | join( "\n", ( join( ' ', ( 'foo' ) x 12 ) ) x 5 ), | ||
| 15 | scalar_variable => | ||
| 16 | '[% scalar_variable %]', | ||
| 17 | hash_variable_value => | ||
| 18 | '[% hash_variable.hash_value_key %]', | ||
| 19 | array_variable_value => | ||
| 20 | '[% array_variable.2 %]', | ||
| 21 | deep_data_structure_value => | ||
| 22 | '[% this.is.a.very.deep.hash.structure %]', | ||
| 23 | array_loop_value => | ||
| 24 | '[% FOREACH i IN array_loop %][% i %][% END %]', | ||
| 25 | hash_loop_value => | ||
| 26 | undef, | ||
| 27 | records_loop_value => | ||
| 28 | '[% FOREACH r IN records_loop %][% r.name %]: ' . | ||
| 29 | '[% r.age %][% END %]', | ||
| 30 | array_loop_template => | ||
| 31 | '[% FOREACH i IN array_loop %][% i %][% END %]', | ||
| 32 | hash_loop_template => | ||
| 33 | undef, | ||
| 34 | records_loop_template => | ||
| 35 | '[% FOREACH r IN records_loop %][% r.name %]: ' . | ||
| 36 | '[% r.age %][% END %]', | ||
| 37 | constant_if_literal => | ||
| 38 | undef, | ||
| 39 | variable_if_literal => | ||
| 40 | '[% IF variable_if %]true[% END %]', | ||
| 41 | constant_if_else_literal => | ||
| 42 | undef, | ||
| 43 | variable_if_else_literal => | ||
| 44 | '[% IF variable_if_else %]true[% ELSE %]false[% END %]', | ||
| 45 | constant_if_template => | ||
| 46 | undef, | ||
| 47 | variable_if_template => | ||
| 48 | '[% IF variable_if %][% template_if_true %][% END %]', | ||
| 49 | constant_if_else_template => | ||
| 50 | undef, | ||
| 51 | variable_if_else_template => | ||
| 52 | '[% IF variable_if_else %][% template_if_true %][% ELSE %]' . | ||
| 53 | '[% template_if_false %][% END %]', | ||
| 54 | constant_expression => | ||
| 55 | undef, | ||
| 56 | variable_expression => | ||
| 57 | undef, | ||
| 58 | complex_variable_expression => | ||
| 59 | undef, | ||
| 60 | constant_function => | ||
| 61 | undef, | ||
| 62 | variable_function => | ||
| 63 | undef, | ||
| 64 | ); | ||
| 65 | |||
| 66 | sub syntax_type { return( 'mini-language' ); } | ||
| 67 | sub pure_perl { return( 1 ); } | ||
| 68 | |||
| 69 | sub benchmark_descriptions | ||
| 70 | { | ||
| 71 | return( { | ||
| 72 | TTiny => | ||
| 73 | "Template::Tiny ($Template::Tiny::VERSION)", | ||
| 74 | } ); | ||
| 75 | } | ||
| 76 | |||
| 77 | sub benchmark_functions_for_uncached_string | ||
| 78 | { | ||
| 79 | my ( $self ) = @_; | ||
| 80 | |||
| 81 | return( { | ||
| 82 | TTiny => | ||
| 83 | sub | ||
| 84 | { | ||
| 85 | my $t = Template::Tiny->new(); | ||
| 86 | my $out; | ||
| 87 | $t->process( \$_[ 0 ], { %{$_[ 1 ]}, %{$_[ 2 ]} }, \$out ); | ||
| 88 | \$out; | ||
| 89 | }, | ||
| 90 | } ); | ||
| 91 | } | ||
| 92 | |||
| 93 | sub benchmark_functions_for_uncached_disk | ||
| 94 | { | ||
| 95 | my ( $self, $template_dir ) = @_; | ||
| 96 | |||
| 97 | return( undef ); | ||
| 98 | } | ||
| 99 | |||
| 100 | sub benchmark_functions_for_disk_cache | ||
| 101 | { | ||
| 102 | my ( $self, $template_dir, $cache_dir ) = @_; | ||
| 103 | |||
| 104 | return( undef ); | ||
| 105 | } | ||
| 106 | |||
| 107 | sub benchmark_functions_for_shared_memory_cache | ||
| 108 | { | ||
| 109 | my ( $self, $template_dir, $cache_dir ) = @_; | ||
| 110 | |||
| 111 | return( undef ); | ||
| 112 | } | ||
| 113 | |||
| 114 | sub benchmark_functions_for_memory_cache | ||
| 115 | { | ||
| 116 | my ( $self, $template_dir, $cache_dir ) = @_; | ||
| 117 | |||
| 118 | return( undef ); | ||
| 119 | } | ||
| 120 | |||
| 121 | sub benchmark_functions_for_instance_reuse | ||
| 122 | { | ||
| 123 | my ( $self, $template_dir, $cache_dir ) = @_; | ||
| 124 | |||
| 125 | return( undef ); | ||
| 126 | } | ||
| 127 | |||
| 128 | 1; | ||
| 129 | |||
| 130 | __END__ | ||