A C++ Quicksort Faster Than std:sort
signa11
38 points
11 comments
November 10, 2026
Related Discussions
Found 5 related stories in 52.1ms across 3,874 title embeddings via pgvector HNSW
- I Can't Believe It Can Sort Muhammad523 · 38 pts · November 13, 2026 · 47% similar
- Valkey kills the skiplist, cuts sorted set overhead by up to 43% reconditerose · 204 pts · November 17, 2026 · 46% similar
- Bbtree: Fastest Ordered Map aoli-al · 86 pts · October 24, 2026 · 43% similar
- Fast-Anything: Don't rewrite it in Rust. Rewrite the 5% that's slow BaselAshraf81 · 182 pts · November 22, 2026 · 41% similar
- Billion-query-per-second lookup tables in C++ foltik · 13 pts · October 28, 2026 · 40% similar
Discussion Highlights (3 comments)
brudgers
Quicksort is quick because it's space requirements are not just linear but very very close to n . It is quick because it minimizes IO. To be clear I did not look at the code, but benchmarking against 50 million items makes me suspect that minimal IO was required. Now sure, sometimes that is exactly your use case. But for many interestingly sized problems, IO dominates.
omoikane
Previously: https://news.ycombinator.com/item?id=48375445 - Branchless Quicksort faster than std:sort and pdqsort with C and C++ API (2026-06-02, 82 comments)
spullara
Fable 5.2 attempted a Lean proof and found a bug in the implementation, it has a fix though: The published blqsort has a bug. In partition, the last loop in the C code only skips elements that are greater than or equal to the pivot. It assumes nothing unsorted is left, and that is false. For example, take 2000 ones with x[1] = 2 and x[2] = 0. The C code returns 0 2 1 1 …, which is not sorted. It fails on about 3 of 4 random seeds. In a C fuzz test of 20,000 random cases, 904 failed. The C++ and threaded versions have the same loop. Because of this bug, no proof can show the published code is correct. https://github.com/chkas/blqsort/issues/4