Beating std::sort - Andrei

the complexity was set to being O(n log n) comparisons on average. /
Generic programming is not bad, but it’s not enough. - Speed Is Found In The Minds of People (CppCon 2019 - Andrei) / r/cpp/

Sort covered:

Other take away:

  • qsort is great for big arrays, terrible for small arrays (so in general rely on other sort for small arrays (see early stopping & THRESHOLD)
  • ungarded_insertion_sort( begin +2, end); // can be ungarded because smallest element at then beginning of the array.
  • micro algorithm
  • what do you do to improve an algorithm that is implemented in a standard library, you look into the standard library.
  • The pit of Hell: the Inner loop

see also:

caption

Written on September 20, 2019, Last update on February 17, 2024
c++ algorithm sort fastware