Nathan Myers explores the relevance of low-level optimizations in sorting algorithms. He highlights the time complexity of in-place sorts and the effect of hardware on sorting efficiency. Myers compares std::sort with radix sort, showcasing the impact of machine architecture on sorting speed. He introduces a novel approach using swap_if function to eliminate conditional branches in quicksort, leading to significant performance improvements. Myers emphasizes the importance of adapting algorithms to modern CPU architectures, mentioning techniques like indexing and cmov instructions. Surprisingly, the optimized code achieves remarkable speed gains, even surpassing std::sort. Myers’ exploration challenges conventional sorting methodologies and offers unique insights into optimizing sorting algorithms for modern hardware.
http://cantrip.org/sortfast.html