Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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

by ikegami (Patriarch)
on Jul 11, 2007 at 17:47 UTC ( [id://626057]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub ikegami (@) {
        my @a=@_;
    ...
        my $x;
        map +( $n=rand($i--), $x=$a[$n], $a[$n]=$a[$i] )[1], @a
    }
    
  2. or download this
               Rate    naive listutil   runrig broweruk  ikegami
    naive     636/s       --      -6%     -19%     -26%     -37%
    ...
    runrig    785/s      23%      16%       --      -9%     -22%
    broweruk  859/s      35%      27%       9%       --     -15%
    ikegami  1010/s      59%      50%      29%      18%       --
    
  3. or download this
    our @data = map { 'x' x 1000 } 1..1000;
    cmpthese -3, { map { $_ => "$_ \@data" } qw/naive listutil broweruk ru
    +nrig ikegami/ };
    
  4. or download this
              Rate   runrig    naive  ikegami listutil broweruk
    runrig   118/s       --     -10%     -40%     -43%     -86%
    ...
    ikegami  197/s      68%      51%       --      -5%     -77%
    listutil 207/s      76%      58%       5%       --     -76%
    broweruk 860/s     632%     558%     336%     315%       --
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-03-29 05:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found