|
|
|
|
|
by eesmith
1380 days ago
|
|
timsort and pdqsort (two comparison sort methods) and radix sort (a non-comparative sorting algorithm) have different albeit overlapping domains of applicability. Given a large number of 32-bit integers, radix sort is indeed significantly faster. While I would reach for a comparison sort method if I had a large number of arbitrary-length Unicode strings, which I wanted to sort in a case-ignoring order. Also, I found timsort faster than radix sort when there was a small number (as I recall, <100 or so) of elements. |
|
Most comparators are of the form "compare by this, then if tied, compare by that, then if tied, compare by the other thing" which is pretty well suited to radix sort. You are correct though.
> While I would reach for a comparison sort method if I had a large number of arbitrary-length Unicode strings, which I wanted to sort in a case-ignoring order.
It seems like the radix sort is likely to be a lot faster for this too, mainly due to cache effects. If you have a dataset in mind I'll be happy to give it a shot.
> Also, I found timsort faster than radix sort when there was a small number (as I recall, <100 or so) of elements.
For sure. 100 isn't so far from the threshold where a radix sort should fall back to something else anyway.