Why std::sort Is So Fast: The Three Algorithms and a Magic Number Behind Its Speed
The article dissects libstdc++'s std::sort implementation, explaining how introsort combines quicksort, heap sort, and insertion sort, why the recursion threshold of 16 and the depth limit of 2·log₂(n) are chosen, and how a sentinel trick eliminates boundary checks for extra performance.
