Help for this page

Select Code to Download


  1. or download this
    use Benchmark qw(cmpthese);
    
    cmpthese(-5, { NoPlus => sub { $_ = 'a' . ('x' x 1000) . 'b'; s/x//g }
    +,
                   Plus   => sub { $_ = 'a' . ('x' x 1000) . 'b'; s/x+//g 
    +} });
    
  2. or download this
    $ perl subs.pl
               Rate NoPlus   Plus
    NoPlus   2674/s     --   -98%
    Plus   115762/s  4230%     --