http://archives.postgresql.org/pgsql-hackers/2005-12/msg00610.php
Here is the program (based on Luke's work):
sort.c
timing.c
qsortB.c
qsortG.c
Makefile
as a tar ball.
Here is the test results:
Here is Dann Corbit's version of qsort:
qsortb.c is the BSD qsort. qsort.c is Plauger's introspective sort. qsb.c is qsortb.c with a check for in-order data. qsortpdq.c is a modified version of qsortb.c with in-order and reversed checks.