I've got this one which runs faster than Discipulus' original version, but I can't get any of them to run faster than vr's on my computer:
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;
},
(Edit: it's a rewritten version of Discipulus2 so I just ++ed it :P)
(Edit2: wait... that's just sortfirst with a grep in scalar context... Haukupulus?)
(Edit3: it was called Discipulus3 which was a bad idea, renamed it GrepPos)
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% --