Skip to main content

How Branch Mispredictions Affect Quicksort

  • Conference paper
Algorithms – ESA 2006 (ESA 2006)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 4168))

Included in the following conference series:

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Hoare, C.A.R.: Algorithm 64: Quicksort. Commun. ACM 4(7), 321 (1961)

    Article  Google Scholar 

  2. Knuth, D.E.: The Art of Computer Programming—Sorting and Searching, vol. 3. Addison-Wesley, Reading (1973)

    Google Scholar 

  3. Martínez, C., Roura, S.: Optimal sampling strategies in Quicksort and Quickselect. SIAM Journal on Computing 31(3), 683–705 (2002)

    Article  Google Scholar 

  4. Sanders, P., Winkel, S.: Super scalar sample sort. In: Albers, S., Radzik, T. (eds.) ESA 2004. LNCS, vol. 3221, pp. 784–796. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  5. Brodal, G.S., Fagerberg, R., Moruz, G.: On the adaptiveness of quicksort. In: Workshop on Algorithm Engineering & Experiments, pp. 130–149. SIAM, Philadelphia (2005)

    Google Scholar 

  6. Brodal, G.S., Moruz, G.: Tradeoffs between branch mispredictions and comparisons for sorting algorithms. In: Dehne, F., López-Ortiz, A., Sack, J.-R. (eds.) WADS 2005. LNCS, vol. 3608, pp. 385–395. Springer, Heidelberg (2005)

    Chapter  Google Scholar 

  7. Patterson, D.A., Hennessy, J.L.: Computer Architecture: A Quantitative Approach, 3rd edn. Morgan Kaufmann, San Francisco (2003)

    Google Scholar 

  8. Sedgewick, R.: Algorithms, 2nd edn. Addison-Wesley Longman Publishing Co., Amsterdam (1988)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2006 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Kaligosi, K., Sanders, P. (2006). How Branch Mispredictions Affect Quicksort. In: Azar, Y., Erlebach, T. (eds) Algorithms – ESA 2006. ESA 2006. Lecture Notes in Computer Science, vol 4168. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11841036_69

Download citation

  • DOI: https://doi.org/10.1007/11841036_69

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-38875-3

  • Online ISBN: 978-3-540-38876-0

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics