Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

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

Hello QuillMeantTen,

There may be a story behind your 're-invention' of sort, but the core 'sort' routine does quite well with these requirements:

> time perl -e '@ar[$_]=int(rand(1000)) for(0..25); print "List: @ar +\n"; @str=sort(@ar);print "Str Cmp: @str\n"; @numr=sort{$a<=>$b} @ar;print "Num Cmp: @numr\n";'
Result:
List: 529 175 516 995 715 296 57 189 999 381 315 612 393 914 716 48 +3 30 58 269 849 180 820 546 20 577 127 Str Cmp: 127 175 180 189 20 269 296 30 315 381 393 483 516 529 546 57 +577 58 612 715 716 820 849 914 995 999 Num Cmp: 20 30 57 58 127 175 180 189 269 296 315 381 393 483 516 529 5 +46 577 612 715 716 820 849 914 995 999 real 0m0.004s user 0m0.004s sys 0m0.000s
Since the standard Perl 'sort' is very powerful and very fast, is there a reason to *improve* it?

Just wondering...Ed

Regards...Ed

"Well done is better than well said." - Benjamin Franklin


In reply to Re: Smoothsort by flexvault
in thread Smoothsort by QuillMeantTen

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (5)
    As of 2020-11-28 10:44 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?