tieredsort - 3.8x faster than std::sort for integers, header-only
Made a sorting library that detects data patterns before sorting.
Results (n=100k):
Random: 3.8x faster than std::sort, 1.6x faster than ska_sort
Dense data (ages, sensors): 30x faster than std::sort, 9x faster than ska_sort
The idea: real data isn't random. Ages are 0-100. Sensors are 12-bit. When the range is small, counting sort beats everything.
Detection cost: 12 comparisons + 64 samples. Negligible.
C++17, header-only, no SIMD needed.
GitHub: https://github.com/Cranot/tieredsort
Looking for feedback on edge cases I might have missed.
https://redd.it/1pu554f
@r_cpp
Post #24547
16