this problem is a great example of a situation where your first instinct (particularly in other langs) may be to reach for a split, then deal with each case using a filter or flip or drop, etc... but the best approach is probably clever indexing. in short: keep it flat
although it gets pretty short in k9 tacit: ,/(~:':;|\~)#\:
@ngn 10^7... it would be interesting to know e.g. when to change from quadratic to merge to radix. but it might be a hard question, as the speed depends on the input values. implying random input may not correlate to use cases. i don't know any better either.
@ktye i think doubles should be compared as if they are longs, after a small correction: negatives should be xor-ed with 0x7f..f, positives should be kept as-is
@ktye right, i just tried arrays of size 10 and radixsort is much slower :(
actually, there's some range of array lengths for which stdlib's mergesort() is fastest