Earlier quoted context omitted.
Sorting is the case study but not the insight. I think the cool/surprising part of the article is that doing more work can be faster... Even more memory work (which per conventional wisdom is not trivial!)
My comment wasn't inherently about sorting either. Branch-free in general is faster in the worst cases, i.e. if the branch is difficult to predict. Except most real-world branches are predictable... that's why we have branch predictors. So in general you should expect branch-free to be slower, unless you have reason to assume your branches are actually close to random.
Lomuto's Comeback
41–50 of 104 posts
Re: Lomuto's Comeback
#42To anyone interested in a deeper treatment of quicksort and variants thereof, I can recommend Sebastian Wild's PhD thesis on that topic: https://kluedo.ub.uni-kl.de/frontdoor/deliver/index/docId/44...
Off topic: Is it common practice for a dissertation at a German university to be written in English?
Re: Lomuto's Comeback
#43If you have a branch free algorithm, you can vectorize it. If he discussed implementing this with SIMD instructions (whether by human hand or compiler auto vectorization) I missed that part. But that seems an interesting angle to me.
Not necessarily. A branch-free algorithm can totally have a data dependency from the previous iteration of the loop to the next, making it impossible to vectorize.
The question is, is there such a dependency in this algorithm? I didn't check.
Re: Lomuto's Comeback
#44Re: Lomuto's Comeback
#45This whole field is a waste of time, and anachronism from when the master copy was paper/pre-computer and computers were just doing the analytics.
Re: Lomuto's Comeback
#46There's an even better branch-free (super scalar) sorting algorithm: "In-place Parallel Super Scalar Samplesort (IPS4o)" which we started using: https://github.com/SaschaWitt/ips4o https://arxiv.org/abs/1705.02257 As an example, to sort 10 million random longs on my computer it takes std::sort 766 ms (roughly in line with Andrei's numbers) and ips4o::sort takes 274 ms. [edit:formatting]
Re: Lomuto's Comeback
#47There's an even better branch-free (super scalar) sorting algorithm: "In-place Parallel Super Scalar Samplesort (IPS4o)" which we started using: https://github.com/SaschaWitt/ips4o https://arxiv.org/abs/1705.02257 As an example, to sort 10 million random longs on my computer it takes std::sort 766 ms (roughly in line with Andrei's numbers) and ips4o::sort takes 274 ms. [edit:formatting]
You might want to mention if are affiliated with the algorithm you are promoting. ipsofacto ~ ips4o
Re: Lomuto's Comeback
#48Earlier quoted context omitted.
You might want to mention if are affiliated with the algorithm you are promoting. ipsofacto ~ ips4o
Or maybe the throwaway was named after the comment it was intended to be used to post.
Another benefit of this algorithm is that it is parallizes extremely well.
Re: Lomuto's Comeback
#49I'm not sure I've ever sorted an array or list. Rather I put things into sets or maps or built in index---I always wanted to access things later, or have an on-line data structure (which a sorted flat thing is not). This whole field is a waste of time, and anachronism from when the master copy was paper/pre-computer and computers were just doing the analytics.
I wrote this comparing the high-level performance of a “set” (AVL or red-black tree) against just that:
Faster lookups, insertions, and in-order traversal than a red-black or AVL tree [0]
[0]: https://neosmart.net/blog/2019/sorted-list-vs-binary-search-...
(Spoiler: it depends on the nature of your data, but sorted vector can be dramatically faster.)
Re: Lomuto's Comeback
#50Earlier quoted context omitted.
Yes - to ensure the widest possible audience. English is the lingua-franca of academia and has been for almost a century now.
At least in MINT fields, probably less so in the humanities. Correct me if I'm wrong.