The idea of multi-pivot quicksort has recently received the attention of researchers after Vladimir Yaroslavskiy proposed a dual pivot quicksort algorithm that, contrary to prior intuition, outperforms standard quicksort by a significant margin under the Java JVM. More recently, this algorithm has been analysed in terms of comparisons and swaps by Wild and Nebel. Our contributions to the topic are as follows. First, we perform the previous experiments using a native C implementation thus removing potential extraneous effects of the JVM. Second, we provide analyses on cache behavior of these algorithms. We then provide strong evidence that cache behavior is causing most of the performance differences in these algorithms. Additionally, we build upon prior work in multi-pivot quicksort and propose a 3-pivot variant that performs very well in theory and practice. We show that it makes fewer comparisons and has better cache behavior than the dual pivot quicksort in the expected case. We validate this with experimental results, showing a 7–8% performance improvement in our tests.
(Based on a paper from ALENEX 2014 by Shrinu Kushagra, Alejandro López-Ortiz, J. Ian Munro, and Aurick Qiao.)