Hasty Briefsbeta

Bilingual

Tieredsort: Header only, blazing fast (3-4x) C++17 sorting for numeric types

4 months ago
  • #sorting
  • #C++
  • #performance
  • tieredsort is a header-only C++17 sorting library optimized for numeric types.
  • It is 3.6x faster than std::sort on random data and 16-21x faster on dense/few-unique data.
  • Automatically selects the optimal sorting strategy based on data characteristics.
  • Supports int32_t, uint32_t, int64_t, uint64_t, float, and double.
  • Includes stable sorting for objects via sort_by_key().
  • No external dependencies or SIMD instructions required.
  • Provides significant speedups for 32-bit types (3.5-5x) and modest improvements for 64-bit types (1.4-1.8x).
  • Features a 3-tier decision tree for algorithm selection: std::sort for small n, counting sort for dense ranges, and radix sort as default.
  • MIT licensed and contributions are welcome.