http://qs321.pair.com?node_id=1142527


in reply to Smoothsort

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