Re: sort constants confusing
- Posted by Spock Jul 04, 2017
- 2573 views
Thanks Pete, now it will take even longer to "sort out."
There is another dimension to this stuff where an "unfashionable" algorithm is better on a small data-set (or some specific dataset) than a "fashionable" algorithm.
_tom
The central routine in msort.zip first checks the size of the data set and then selects one of two options:
n < 200 (call fast insertion sort)
else (call merge sort supplemented with fast insertion sort)
So whatever n there is the sort performance is always good, always stable. And without the stability property sorting by column is not guaranteed to be correct - an important goal in the real-world. Quicksort and Shellsort [Edit: Heapsort too] are not naturally stable sorts.
It would be interesting to compare the performance of the Phix code on Rosetta versus msort but.. I couldn't get the former to work (something about blah blah Visual .. 2013 blah blah) so I gave up.
Spock