6 ms·
I split the code in two binaries: "code" (qsort) and "code2" (std::sort()) and then I ran both under a profiler (based on intel's performance counters). It sea
by hanbam 15y ago
I split the code in two binaries: "code" (qsort) and "code2" (std::sort()) and then I ran both under a profiler (based on intel's performance counters).
It seams that qsort simply executes an order of magnitude more instructions for the same result than std::sort. On the other hand std::sort() code, even if it's faster, it has more branch miss-predictions.
Here [1] are the results if you want to have a look.
[1] https://gist.github.com/b97a6395c9a20c3d4cea https://gist.github.com/b97a6395c9a20c3d4cea
- radiospiel 15y agoThanks, that is quite interesting.