CGI-Ex-Template-XS

 view release on metacpan or  search on metacpan

samples/bench_template.pl  view on Meta::CPAN

### set a few globals that will be available in our subs
my $show_list = grep {$_ eq '--list'} @ARGV;
my $run_all   = grep {$_ eq '--all'}  @ARGV;
my @run = $run_all ? () : @ARGV;
my $str_ref;
my $filename;

### uncomment to run a specific test - otherwise all tests run
#@run = qw(07);

#                                                                         ### All percents are CGI::Ex::Template::XS vs TT2 with Stash::XS
#                                                                         ### (The percent that CET is faster than TT)
#                                                                               Existing object by string ref #
#                                                                      New object with CACHE_EXT set #        #
#                                                   New object each time (undef CACHE_SIZE) #        #        #
#                              This percent is compiled in memory (repeated calls) #        #        #        #
my $tests = {                                                             #        #        #        #        #
    '01_empty'     => "",                                                 #  268%  #  585%  #  318%  #  414%  # 23863.2/s #
    '02_var_sma'   => "[% one %]",                                        #  225%  #  563%  #  465%  #  466%  # 19051.2/s #
    '03_var_lar'   => "[% one %]"x100,                                    #  223%  #  405%  #  196%  #  396%  # 2508.9/s #
    '04_set_sma'   => "[% SET one = 2 %]",                                #  206%  #  489%  #  433%  #  372%  # 17831.8/s #
    '05_set_lar'   => "[% SET one = 2 %]"x100,                            #   88%  #  252%  #   68%  #  259%  # 1572.8/s #
    '06_set_range' => "[% SET one = [0..30] %]",                          #   68%  #  292%  #  268%  #  199%  # 9586.9/s #
    '07_chain_sm'  => "[% hash.a %]",                                     #  246%  #  602%  #  460%  #  504%  # 18270.1/s #
    '08_mixed_sma' => "".((" "x100)."[% one %]\n")x10,                    #  226%  #  546%  #  374%  #  521%  # 11274.8/s #
    '09_mixed_med' => "".((" "x10)."[% one %]\n")x100,                    #  227%  #  502%  #  266%  #  499%  # 2327.1/s #



( run in 0.361 second using v1.01-cache-2.11-cpan-709fd43a63f )