Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Fastest way to sort a list of integers into 0,1,2,3,-3,-2,-1

by Eily (Monsignor)
on Feb 05, 2019 at 17:40 UTC ( #1229425=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      GrepPos => sub{
        my @list = @input;
        my $pos =  grep { $_ >= 0 } @list;
        @list[$pos..$#list, 0..$pos-1] = sort {$a<=>$b} @list;
        Compare(\@list,\@output) or die "@list" if DO_CHECK;
      },
    
  2. or download this
                   Rate        Eily  Discipulus Discipulus3          vr
    Eily        21060/s          --        -55%        -61%        -65%
    Discipulus  47134/s        124%          --        -13%        -22%
    GrepPos     54377/s        158%         15%          --        -10%
    vr          60414/s        187%         28%         11%          --
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2022-01-17 16:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (51 votes). Check out past polls.

    Notices?