The C programming language
Introspective sorting and selection algorithms
Software—Practice & Experience
Nordic Journal of Computing
A Meticulous Analysis of Mergesort Programs
CIAC '97 Proceedings of the Third Italian Conference on Algorithms and Complexity
ESA'06 Proceedings of the 14th conference on Annual European Symposium - Volume 14
How branch mispredictions affect quicksort
ESA'06 Proceedings of the 14th conference on Annual European Symposium - Volume 14
An experimental study of sorting and branch prediction
Journal of Experimental Algorithmics (JEA)
Computer Organization and Design, Fourth Edition, Fourth Edition: The Hardware/Software Interface (The Morgan Kaufmann Series in Computer Architecture and Design)
Introduction to Algorithms, Third Edition
Introduction to Algorithms, Third Edition
Tradeoffs between branch mispredictions and comparisons for sorting algorithms
WADS'05 Proceedings of the 9th international conference on Algorithms and Data Structures
Lean programs, branch mispredictions, and sorting
FUN'12 Proceedings of the 6th international conference on Fun with Algorithms
Hi-index | 0.00 |
In quicksort, due to branch mispredictions, a skewed pivot-selection strategy can lead to a better performance than the exact-median pivot-selection strategy, even if the exact median is given for free. In this paper we investigate the effect of branch mispredictions on the behaviour of mergesort. By decoupling element comparisons from branches, we can avoid most negative effects caused by branch mispredictions. When sorting a sequence of n elements, our fastest version of mergesort performs n log2n+O(n) element comparisons and induces at most O(n) branch mispredictions. We also describe an in-situ version of mergesort that provides the same bounds, but uses only O(log2n) words of extra memory. In our test computers, when sorting integer data, mergesort was the fastest sorting method, then came quicksort, and in-situ mergesort was the slowest of the three. We did a similar kind of decoupling for quicksort, but the transformation made it slower.