ocehb: (Default)
[personal profile] ocehb



sub shuffle (@) {
    return ( [ $_[0],$_[1] ],[ $_[1],$_[0] ] ) if (scalar @_ == 2);

    my $b = shift @_;
    my @ret;
    foreach my $r (shuffle (@_)) {
        foreach (0..scalar @$r) {
            my (@rr) = @$r;
            splice @rr,$_,0,$b;
            push @ret,\@rr;
        }
    }
    return @ret;
}


# time perl a.pl 1 2 3 4 5 6 | wc -l
     720
Real: 0.07s User: 0.05s System: 0.01s Percent: 90%% Cmd: perl a.pl 1 2 3 4 5 6
Real: 0.07s User: 0.00s System: 0.00s Percent: 5%% Cmd: wc -l
# time perl a.pl 1 2 3 4 5 6 7 8 9 | wc -l
  362880
Real: 7.43s User: 6.65s System: 0.63s Percent: 98%% Cmd: perl a.pl 1 2 3 4 5 6 7 8 9
Real: 7.42s User: 0.07s System: 0.01s Percent: 1%% Cmd: wc -l
# time perl a.pl 1 2 3 4 5 6 7 8 9 0 | wc -l
Out of memory during request for 1012 bytes, total sbrk() is 536786944 bytes!
       0
Real: 56.49s User: 16.54s System: 4.47s Percent: 37%% Cmd: perl a.pl 1 2 3 4 5 6 7 8 9 0
Real: 56.49s User: 0.00s System: 0.00s Percent: 0%% Cmd: wc -l
#


This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org

Profile

ocehb: (Default)
ocehb

January 2021

S M T W T F S
     12
345 6789
10111213141516
17181920212223
24252627282930
31      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 9th, 2026 09:32 pm
Powered by Dreamwidth Studios