Hacker News front page3 min readintermediate
Vectorized and performance-portable Quicksort (2022)
Summary
Google’s Highway library now includes a fully portable SIMD‑vectorized quicksort that runs 9‑19× faster than C++ std::sort. By using compress‑store (or permute‑based emulation) for partitioning, the same C++ code targets AVX2, AVX‑512, NEON, SVE and RISC‑V V. Benchmarks show 0.5 GB/s on an Apple M1 and >1 GB/s on a 3 GHz Skylake, beating prior architecture‑specific sorts. The implementation and a…
- Vectorized quicksort built on Highway’s portable SIMD primitives; no per‑arch code‑gen needed.
- Uses hardware compress‑store when available, otherwise emulates it with permutes – the key to fast partitioning.
- Achieves 9‑19× speedup over std::sort on 32/64/128‑bit integers, with 0.5‑1.1 GB/s throughput on a single core.
- Supports six instruction sets across x86, Arm and RISC‑V, handling 16‑128‑bit element types.
Sorting is a core primitive in columnar databases and analytics workloads. A portable, SIMD‑accelerated quicksort that delivers >1 GB/s per core can dramatically reduce query latency and enable new in‑memory processing patterns without vendor‑locked code.
7/10





