qsort has to invoke your comparison function repeatedly, which incurs a lot of overhead. Try C++'s std::sort
Summarize: Slower than std::sort except on random tail.
Also a very important tidbit that std::sort is 10x faster than c's qsort for ordered inputs.