Help for this page

Select Code to Download


  1. or download this
    sub blokhead (@) {
        my @a = (0 .. $#_);
    ...
        my $n;
        map+( $n=rand($i--), $_[$a[$n]], $a[$n]=$a[$i] )[ 1 ], @_;
    }
    
  2. or download this
    our @data = map { 'x' x 1000 } 1..1000;
    cmpthese -2, { map { $_ => "$_ \@data" } qw/naive listutil buk ikegami
    + blokhead/ };
    ...
    listutil  143/s      89%      39%       --     -78%     -78%
    buk       638/s     739%     518%     345%       --      -1%
    blokhead  643/s     745%     522%     348%       1%       --
    
  3. or download this
    our @data = ("xxx") x 1000;
    cmpthese -2, { map { $_ => "$_ \@data" } qw/naive listutil buk ikegami
    + blokhead/ };
    ...
    ikegami  589/s      80%      32%       --      -8%      -9%
    buk      637/s      94%      43%       8%       --      -1%
    blokhead 646/s      97%      45%      10%       1%       --