# Google's new sorting algorithm is 10x faster

> A portable vectorized Quicksort outperforms standard libraries across all modern CPU architectures.
- Title: Google's new sorting algorithm is 10x faster · Googleblog
- Summary: A portable vectorized Quicksort outperforms standard libraries across all modern CPU architectures. Using SIMD vector instructions, Google created a sorting…
- Keywords: google, quicksort, simd, vector instructions, sorting algorithm, cpu performance, avx-512, avx2, arm neon, columnar databases, open source, technology
- Source: Googleblog — https://opensource.googleblog.com/2022/06/Vectorized%20and%20performance%20portable%20Quicksort.html
- Read time: 1 min
- Topics: google, quicksort, simd, vector instructions, sorting algorithm, cpu performance, avx-512, avx2, arm neon, columnar databases, open source, technology
## Ten times faster sorting
Google released open source code that sorts arrays about ten times faster than C++ std::sort while working across all modern CPU architectures.

> sort arrays of numbers about ten times as fast as the C++ std::sort
## Why columnar databases matter
Columnar databases store all values from one column together, making filtering and sorting faster. This layout is key for SQL queries, so Google focused on optimizing it.
## SIMD instructions unlock speed
SIMD vector instructions process multiple independent elements in a single operation. AVX-512 handles 16 float32 values at once, while Arm NEON handles four, enabling massive parallelization.

> These carry out operations on multiple independent elements in a single instruction
## Partitioning is the bottleneck
Quicksort partitions arrays into smaller chunks. This partitioning step uses most CPU time, so optimizing it with SIMD compress-store instructions delivers the biggest speed gains.

> Partitioning accounts for most of the CPU time
## Portable across six instruction sets
Google's implementation works on AVX2, AVX-512, Arm NEON, Arm SVE, RISC-V V, and x86 using Highway's portable SIMD functions, avoiding 3,000 lines of platform-specific code.
## Record speeds on all platforms
On Apple M1, the code sorts at 499 MB/s for 32-bit numbers. On Intel Skylake with AVX-512, it reaches 1,123 MB/s. Standard library achieves only 58 MB/s, a 9-19x improvement.

> 9-19x speedup depending on the type of numbers
## New applications now possible
Sorting at 1 GB/s on a single CPU core opens possibilities for new applications. The Apache2-licensed code is available on GitHub with a detailed research paper.
## Key takeaway

Using SIMD vector instructions, Google created a sorting algorithm that works across different processors while being dramatically faster than existing solutions.