Back to browse
Faster than std:sort and pdqsort

Faster than std:sort and pdqsort

by chrka·May 20, 2026·1 point·0 comments

AI Analysis

●●●BangerWizardryBig Brain

Beats std::sort by 24% on M1 using sorting networks for small subsets and branchless partitioning.

Strengths
  • Custom sorting networks for 2-12 elements minimize swaps using branchless sort-2 primitives.
  • Median-of-medians pivot selection prevents O(n²) degradation on adversarial input data.
  • BlockQuicksort variant handles complex types by processing indices instead of moving data.
Weaknesses
  • Performance gains diminish significantly for types with high copy or move costs.
  • Requires separate code paths for each small subset size, increasing binary complexity.
Target Audience

Systems programmers and performance engineers

Similar To

pdqsort · fluxsort · folly::sort

Similar Projects