Help for this page

Select Code to Download


  1. or download this
               s/iter filehandle      regex      index      split
    filehandle    100         --       -97%       -97%       -98%
    regex        3.50      2758%         --       -14%       -42%
    index        3.02      3217%        16%         --       -33%
    split        2.02      4868%        74%        50%         --
    
  2. or download this
               s/iter      regex      index      split filehandle
    regex        3.69         --        -2%       -29%       -39%
    index        3.63         2%         --       -27%       -38%
    split        2.63        40%        38%         --       -15%
    filehandle   2.25        64%        61%        17%         --
    
  3. or download this
        filehandle2 => sub {
            open my $str_fh, "<", \$str or die "cannot open fh $!";
    ...
                ;
            }
         },
    
  4. or download this
    $ perl bench_split.pl
                s/iter       regex       index       split filehandle2  fi
    +lehandle
    ...
    split         2.24         53%         39%          --        -16%    
    +    -20%
    filehandle2   1.89         82%         65%         19%          --    
    +     -5%
    filehandle    1.80         92%         73%         25%          5%    
    +      --
    
  5. or download this
        filehandle3 => sub {
            open my $str_fh, "<", \$str or die "cannot open fh $!";
            my @lines = map { chomp; s/o/i/g } <$str_fh>;
         },
    
  6. or download this
    $ perl bench_split.pl
                s/iter filehandle3       regex       index       split  fi
    +lehandle
    ...
    index         3.07         18%         10%          --        -28%    
    +    -42%
    split         2.22         64%         52%         38%          --    
    +    -20%
    filehandle    1.77        105%         90%         73%         25%    
    +      --