L~R,

I had not considered the secondary sort by title. Nice touch!

I added your example into my benchmark tests which now include my original hack, Abigail's bucketsort example and yours (which looks to me like a Schwarztian Transform, no?). Yours takes the cake:

Benchmark: timing 500000 iterations of bucketsort, sort, st... bucketsort: 1 wallclock secs ( 1.73 usr + 0.00 sys = 1.73 CPU) @ 28 +9017.34/s (n=500000) sort: 1 wallclock secs ( 0.90 usr + 0.00 sys = 0.90 CPU) @ 55 +5555.56/s (n=500000) st: 0 wallclock secs ( 0.66 usr + 0.00 sys = 0.66 CPU) @ 75 +7575.76/s (n=500000) Rate bucketsort sort st bucketsort 289017/s -- -48% -62% sort 555556/s 92% -- -27% st 757576/s 162% 36% --

Thanks,

-Wm

In reply to Re: Re: Efficiently sorting array by non-alpha strings by knowmad
in thread Efficiently sorting array by non-alpha strings by knowmad

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, details, 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, summary, 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.