Help for this page

Select Code to Download


  1. or download this
    use Benchmark 'cmpthese';
    my $str1 = 'foobarbazqux';
    my $str2 = 'foobar';
    ...
    substr  1421801/s     34%     16%      --    -23%    -63%
    substr2 1851852/s     74%     51%     30%      --    -51%
    index   3797468/s    257%    209%    167%    105%      --
    
  2. or download this
    use Benchmark 'cmpthese';
    my $str1 = 'foobarbazqux';
    my $str2 = 'foobar';
    ...
    substr  1630435/s    143%      --    -16%    -30%
    substr2 1935484/s    188%     19%      --    -17%
    index   2343750/s    249%     44%     21%      --