pdqsort - a faster std::sort

Orson Peters orsonpeters at gmail.com
Tue Mar 24 19:38:49 PDT 2015


A while back I shortly discussed this with M. Clow, today I post it here to
poll public interest.

I'd like to present pattern-defeating quicksort, a novel sorting algorithm.
It is as fast or faster than std::sort on any implementation I've tested
(libstdc++, libc++, VS2013) for both random data and a variety of patterns
(equal, asc/desc, pipe organ, etc).

A short explanation of the design of pdqsort can be found in the readme:
https://github.com/orlp/pdqsort .

The performance chart included in the readme is benchmarked against
libstdc++, a comparison with libc++ (compiled with clang) can be found
here: http://i.imgur.com/JRiJk0g.png .

The code of pdqsort is very short (~300LOC) and clean. Understanding
pdqsort and integration should be painless.

I'm willing to prepare a patch and do the legal wizardry required to
integrate pdqsort as std::sort in libstdc++, if the interest is there. This
would also solve this bug I found:
https://llvm.org/bugs/show_bug.cgi?id=20837

If you have any questions after reading the readme, please do reply and I
will do my best to answer them.


Greetings,

Orson Peters
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150325/266db61c/attachment.html>


More information about the cfe-commits mailing list