Replaced super slow qsort by much faster std::sort.

std::sort is a template function so the compiler can inline the comparator
avoiding unnecessary calls. In contrast, qsort is a non-template function
taking a function pointer which results in one function call per comparison
9 jobs for performance_fixes in 56 minutes and 47 seconds (queued for 1 second)