Created
April 3, 2010 04:01
-
-
Save gfx/354094 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Perl/5.10.1 on i686-linux | |
| Text::ClearSilver/0.10.5.1 | |
| HTML::Template::Pro/0.94 | |
| MobaSiF::Template/0.02 | |
| Persistent processes: | |
| Rate H::T::Pro T::CS MobaSiF::T | |
| H::T::Pro 10368/s -- -46% -51% | |
| T::CS 19029/s 84% -- -11% | |
| MobaSiF::T 21295/s 105% 12% -- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!perl | |
| use strict; | |
| use Benchmark qw(:all); | |
| use Config; printf "Perl/%vd on %s\n", $^V, $Config{archname}; | |
| use Text::ClearSilver; | |
| use HTML::Template::Pro; | |
| use MobaSiF::Template; | |
| foreach my $mod(qw(Text::ClearSilver HTML::Template::Pro MobaSiF::Template)) { | |
| print $mod, "/", $mod->VERSION, "\n"; | |
| } | |
| my $vars = { | |
| hoge => 1, | |
| fuga => "fuga", | |
| }; | |
| my @load_path = qw(benchmark/template); | |
| $vars->{hdf}{loadpaths} = \@load_path; | |
| my $mst_in = "benchmark/template/simple.mst"; | |
| my $mst_bin = "benchmark/template/simple.mst.out"; | |
| if(0){ | |
| my $tcs = Text::ClearSilver->new(); | |
| print "T::CS\n"; | |
| $tcs->process('simple.cs', $vars); | |
| print "MobaSiF::T\n"; | |
| $MobaSiF::Template::DEVELOP = 1; | |
| MobaSiF::Template::Compiler::compile($mst_in, $mst_bin); | |
| print MobaSiF::Template::insert($mst_bin, $vars); | |
| exit; | |
| } | |
| print "Persistent processes:\n"; | |
| my $tcs = Text::ClearSilver->new(); | |
| my $ht = HTML::Template::Pro->new( | |
| filename => 'simple.ht', | |
| case_sensitive => 1, | |
| path => \@load_path, | |
| ); | |
| cmpthese -1, { | |
| 'T::CS' => sub { | |
| $tcs->process('simple.cs', $vars, \my $output); | |
| return; | |
| }, | |
| 'MobaSiF::T' => sub { | |
| MobaSiF::Template::insert($mst_bin, $vars); | |
| return; | |
| }, | |
| 'H::T::Pro' => sub { | |
| $ht->param(%{$vars}); | |
| my $output = $ht->output(); | |
| return; | |
| }, | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment