in reply to Re^3: Array Sort
in thread Array Sort

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.