lib/Template/Benchmark/Engines/HTMLTemplateJIT.pm

filter: Statementstmt 83.3% 10 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 87.5% 14 / 16 CC 1 SCAR 0.7
CC
1
Cov
83%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« lib/Template/Benchmark/Engines/HTMLTemplateExpr.pm ↑ Summary lib/Template/Benchmark/Engines/HTMLTemplatePro.pm »
1 package Template::Benchmark::Engines::HTMLTemplateJIT;
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 HTML::Template::JIT;
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 '<TMPL_VAR NAME=scalar_variable>',
17 hash_variable_value =>
18 undef,
19 array_variable_value =>
20 undef,
21 deep_data_structure_value =>
22 undef,
23 array_loop_value =>
24 undef,
25 hash_loop_value =>
26 undef,
27 records_loop_value =>
28 '<TMPL_LOOP NAME=records_loop><TMPL_VAR NAME=name>: ' .
29 '<TMPL_VAR NAME=age></TMPL_LOOP>',
30 array_loop_template =>
31 undef,
32 hash_loop_template =>
33 undef,
34 records_loop_template =>
35 '<TMPL_LOOP NAME=records_loop><TMPL_VAR NAME=name>: ' .
36 '<TMPL_VAR NAME=age></TMPL_LOOP>',
37 constant_if_literal =>
38 undef,
39 variable_if_literal =>
40 '<TMPL_IF NAME=variable_if>true</TMPL_IF>',
41 constant_if_else_literal =>
42 undef,
43 variable_if_else_literal =>
44 '<TMPL_IF NAME=variable_if_else>true<TMPL_ELSE>false</TMPL_IF>',
45 constant_if_template =>
46 undef,
47 variable_if_template =>
48 '<TMPL_IF NAME=variable_if><TMPL_VAR NAME=template_if_true></TMPL_IF>',
49 constant_if_else_template =>
50 undef,
51 variable_if_else_template =>
52 '<TMPL_IF NAME=variable_if_else><TMPL_VAR NAME=template_if_true>' .
53 '<TMPL_ELSE><TMPL_VAR NAME=template_if_false></TMPL_IF>',
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 HTJ =>
73 "HTML::Template::JIT ($HTML::Template::JIT::VERSION)",
74 } );
75 }
76  
77 sub benchmark_functions_for_uncached_string
78 {
79 my ( $self ) = @_;
80  
81 return( undef );
82 }
83  
84 sub benchmark_functions_for_uncached_disk
85 {
86 my ( $self, $template_dir ) = @_;
87  
88 return( undef );
89 }
90  
91 sub benchmark_functions_for_disk_cache
92 {
93 my ( $self, $template_dir, $cache_dir ) = @_;
94  
95 return( undef );
96 }
97  
98 sub benchmark_functions_for_shared_memory_cache
99 {
100 my ( $self, $template_dir, $cache_dir ) = @_;
101  
102 return( undef );
103 }
104  
105 sub benchmark_functions_for_memory_cache
106 {
107 my ( $self, $template_dir, $cache_dir ) = @_;
108 my ( @template_dirs );
109  
110 @template_dirs = ( $template_dir );
111  
112 # HTJ gets compiled to disk, but then is cached in memory.
113 return( {
114 HTJ =>
115 sub
116 {
117 my $t = HTML::Template::JIT->new(
118 path => \@template_dirs,
119 filename => $_[ 0 ],
120 jit_path => $cache_dir,
121 case_sensitive => 1,
122 # die_on_bad_params => 0,
123 );
124 $t->param( $_[ 1 ] );
125 $t->param( $_[ 2 ] );
126 my $out = $t->output();
127 \$out;
128 },
129 } );
130 }
131  
132 sub benchmark_functions_for_instance_reuse
133 {
134 my ( $self, $template_dir, $cache_dir ) = @_;
135  
136 return( undef );
137 }
138  
139 1;
140  
141 __END__
« lib/Template/Benchmark/Engines/HTMLTemplateExpr.pm ↑ Summary lib/Template/Benchmark/Engines/HTMLTemplatePro.pm »