Vectorized and performance-portable Quicksort

Mark Blacher, Joachim Giesen, Peter Sanders, Jan Wassenberg
5/12/2022
cs.IRcs.DC

Official code: google/highway (5,986 stars, C++, last commit 2026-11-21).

Abstract

Recent works showed that implementations of Quicksort using vector CPU instructions can outperform the non-vectorized algorithms in widespread use. However, these implementations are typically single-threaded, implemented for a particular instruction set, and restricted to a small set of key types.

Show full abstract

We lift these three restrictions: our proposed 'vqsort' algorithm integrates into the state-of-the-art parallel sorter 'ips4o', with a geometric mean speedup of 1.59. The same implementation works on seven instruction sets (including SVE and RISC-V V) across four platforms. It also supports floating-point and 16-128 bit integer keys. To the best of our knowledge, this is the fastest sort for non-tuple keys on CPUs, up to 20 times as fast as the sorting algorithms implemented in standard libraries. This paper focuses on the practical engineering aspects enabling the speed and portability, which we have not yet seen demonstrated for a Quicksort implementation. Furthermore, we introduce compact and transpose-free sorting networks for in-register sorting of small arrays, and a vector-friendly pivot sampling strategy that is robust against adversarial input.

View on arXivView PDF

Code Implementations(1)

google/highwayOfficial100%

Performance-portable, length-agnostic SIMD with runtime dispatch

5,986500C++, CSep 6, 20191 weeks agoNOASSERTION
avxavx-512avx-instructionsavx2avx512+10 more

Similar Papers

Cite this paper

@article{blacher2022vectorized,
  title  = {Vectorized and performance-portable Quicksort},
  author = {Mark Blacher and Joachim Giesen and Peter Sanders and Jan Wassenberg},
  year   = {2022},
  eprint = {2205.05982},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2205.05982}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2205.05982.svg)](https://codeofpaper.com/paper/2205.05982)

Discussion