Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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% --

In reply to Re: Fastest way to sort a list of integers into 0,1,2,3,-3,-2,-1 by Eily
in thread Fastest way to sort a list of integers into 0,1,2,3,-3,-2,-1 by haukex

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2022-01-17 04:56 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (51 votes). Check out past polls.