Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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

by Tux (Canon)
on Feb 05, 2019 at 14:31 UTC ( #1229409=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    cmpthese (-2, {
        sortfirst => sub {
    ...
            DO_CHECK and (Compare (\@list, [0..5, -5..-1]) or die "@list")
    +;
            },
        });
    
  2. or download this
                  Rate     pryrt packunpck   choroba grepfirst sortfirst
    pryrt     123672/s        --      -35%      -39%      -66%      -73%
    ...
    choroba   204244/s       65%        7%        --      -44%      -56%
    grepfirst 367991/s      198%       94%       80%        --      -20%
    sortfirst 460545/s      272%      142%      125%       25%        --
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (None)
    As of 2021-10-21 02:33 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My first memorable Perl project was:







      Results (82 votes). Check out past polls.

      Notices?