Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: About List::Util's pure Perl shuffle()

by blokhead (Monsignor)
on Jul 12, 2007 at 02:03 UTC ( #626127=note: print w/ replies, xml ) Need Help??

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%       --
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://626127]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2014-08-28 07:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (257 votes), past polls