Help for this page

Select Code to Download


  1. or download this
    use strict;
    use Benchmark qw(cmpthese);
    ...
      'chars'   => sub { $foo =~ /[Aa][Bb][Cc]/og },
      'charvar' => sub { $foo =~ /$re/og },
    });
    
  2. or download this
    Benchmark: timing 1000000 iterations of chars, charvar, i...
         chars:  2 wallclock secs ( 1.97 usr +  0.00 sys =  1.97 CPU) @ 50
    +7614.21/s (n=1000000)
    ...
    charvar 492611/s      --     -3%    -35%
    chars   507614/s      3%      --    -34%
    i       763359/s     55%     50%      --