X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=samples%2Fbenchmark%2Fbench_template.pl;fp=samples%2Fbenchmark%2Fbench_template.pl;h=7b48028a0deb5e232f6942d60c62616b7cb1aeb0;hb=d710d6cd21be21c0ab2df3566c2bd61d9015cac6;hp=450078b1c3d3c6d8c89d16ad63f114e8393013ae;hpb=d2b7c937e86e6e8c4b4193e9f4a8da075919b4fd;p=chaz%2Fp5-CGI-Ex diff --git a/samples/benchmark/bench_template.pl b/samples/benchmark/bench_template.pl index 450078b..7b48028 100644 --- a/samples/benchmark/bench_template.pl +++ b/samples/benchmark/bench_template.pl @@ -83,6 +83,27 @@ my $longer_template = "[% INCLUDE bar.tt %]" ."[% array.join('|') %]" ."[% PROCESS bar.tt %]"; +my $hello2000 = "[% title %] +[% array = [ \"Hello\", \"World\", \"2000\", \"Hello\", \"World\", \"2000\" ] %] +[% sorted = array.sort %] +[% multi = [ sorted, sorted, sorted, sorted, sorted ] %] + +[% FOREACH row = multi %] + + [% FOREACH col = row %] + + [% END %] + +[% END %] +
[% col %]
+[% param = integer %] +[% FOREACH i = [ 1 .. 10 ] %] + [% var = i + param %]" + .("\n [%var%] Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World
"x20)." +[% END %] + +"; + ###----------------------------------------------------------------### ### set a few globals that will be available in our subs my $show_list = grep {$_ eq '--list'} @ARGV; @@ -146,7 +167,8 @@ my $tests = { # '43_filteruri' => "[% ' ' | uri %]", # 132% # 550% # 379% # 471% # 12524.4/s # '44_filterevl' => "[% foo | eval %]", # 303% # 530% # 434% # 478% # 5475.5/s # '45_capture' => "[% foo = BLOCK %]Hi[% END %][% foo %]", # 102% # 386% # 291% # 304% # 10606.5/s # - '46_complex' => "$longer_template", # 55% # 288% # 133% # 251% # 1230.3/s # + '46_complex' => "$longer_template", # 60% # 290% # 160% # 270% # 1054.3/s # + '47_hello2000' => "$hello2000", # 2% # 136% # 39% # 115% # 184.8/s # # overall # 95% # 406% # 251% # 346% #