Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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

by tybalt89 (Prior)
on Feb 05, 2019 at 16:02 UTC ( #1229416=note: print w/replies, xml ) Need Help??


in reply to Fastest way to sort a list of integers into 0,1,2,3,-3,-2,-1

array => sub { my @list = @input; @list[@input] = @input; Compare(\@list,\@output) or die "@list" if DO_CHECK; },

When added, outputs:

Rate johngg Tux pryrt choroba0 choroba choroba2 grepfirs +t sortfirst Eily array johngg 6047/s -- -26% -36% -57% -67% -69% -70 +% -73% -83% -93% Tux 8142/s 35% -- -14% -42% -55% -58% -60 +% -64% -77% -90% pryrt 9471/s 57% 16% -- -32% -48% -51% -54 +% -58% -73% -89% choroba0 13922/s 130% 71% 47% -- -23% -28% -32 +% -38% -61% -83% choroba 18181/s 201% 123% 92% 31% -- -6% -11 +% -19% -49% -78% choroba2 19424/s 221% 139% 105% 40% 7% -- -5 +% -13% -45% -77% grepfirst 20451/s 238% 151% 116% 47% 12% 5% - +- -8% -42% -75% sortfirst 22333/s 269% 174% 136% 60% 23% 15% 9 +% -- -37% -73% Eily 35540/s 488% 337% 275% 155% 95% 83% 74 +% 59% -- -57% array 83332/s 1278% 923% 780% 499% 358% 329% 307 +% 273% 134% --

It passes your test case, so for (some) perl golfs, it is considered correct :)

Replies are listed 'Best First'.
Re^2: Fastest way to sort a list of integers into 0,1,2,3,-3,-2,-1
by trippledubs (Deacon) on Feb 05, 2019 at 16:10 UTC
    cool but fail :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2021-10-19 18:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (77 votes). Check out past polls.

    Notices?