My point was that it requires a pretty expensive key extraction for the ST to be beneficial.

For example, with fileno the ST never gets a look in and it requires a 1000+ files before the GRT starts to make inroads:

c:\test>junk92 *.txt Files: 46 Rate ST GRT1 GRT2 sort ST 9206/s -- -21% -27% -58% GRT1 11725/s 27% -- -8% -46% GRT2 12681/s 38% 8% -- -42% sort 21855/s 137% 86% 72% -- c:\test>junk92 *.pl Files: 657 Rate ST GRT1 GRT2 sort ST 411/s -- -39% -44% -46% GRT1 675/s 64% -- -8% -11% GRT2 735/s 79% 9% -- -3% sort 757/s 84% 12% 3% -- c:\test>junk92 * Files: 1293 Rate ST GRT1 sort GRT2 ST 186/s -- -41% -45% -46% GRT1 315/s 70% -- -7% -8% sort 338/s 82% 7% -- -1% GRT2 341/s 84% 8% 1% --

So, by the time you get to the point where the standard sort, even with numeric keys, can be beaten, you might as well move to straight to a GRT and have done with it.

sort => q[ my @fhs = sort { fileno( $a ) <=> fileno( $b ) } @fhs; ],

Others per your code.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^4: Array Sort by BrowserUk
in thread Array Sort by gopalr

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.