How branch mispredictions affect quicksort

  • Authors:
  • Kanela Kaligosi;Peter Sanders

  • Affiliations:
  • Max Planck Institut für Informatik, Saarbrücken, Germany;Universität Karlsruhe, Germany

  • Venue:
  • ESA'06 Proceedings of the 14th conference on Annual European Symposium - Volume 14
  • Year:
  • 2006

Quantified Score

Hi-index 0.00

Visualization

Abstract

We explain the counterintuitive observation that finding "good" pivots (close to the median of the array to be partitioned) may not improve performance of quicksort. Indeed, an intentionally skewed pivot improves performance. The reason is that while the instruction count decreases with the quality of the pivot, the likelihood that the direction of a branch is mispredicted also goes up. We analyze the effect of simple branch prediction schemes and measure the effects on real hardware.