Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by blokhead (Monsignor)
on Jul 12, 2007 at 02:03 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://626127]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-26 04:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found