[Bizgres-general] Slow glibc qsort, two versions that are much faster

Simon Riggs simon at 2ndquadrant.com
Fri Dec 9 08:36:33 GMT 2005


On Fri, 2005-12-09 at 00:10 -0800, Luke Lonergan wrote:
> I found the routine "qsortG" here:
>   http://homepage.ntlworld.com/g.mccaughan/software/qsort.c-1.12
> 
> In my tests (attached, and results below), the qsortG routine outperforms
> the Linux/qlibc qsort routine by as much as 94% (10 times).  It's different
> on Mac OSX and Solaris where the zero set seems to have a fast
> implementation.

Sounds good and licence is compatible.

Can you explain the zero set thing a bit more? Not quite sure what that
is. Empty set? All same key?

> I'm not sure how much this matters to us, as qsort is likely only used by
> Postgres for in-memory sorts, though it might be (haven't looked) used
> within the N-tape algorithm for disk sorts.

No, its not used.

But this can still be important to us since we can now use multiple GBs
of memory. With partitioning, we might find that is sufficient for many
needs.

Best Regards, Simon Riggs



More information about the Bizgres-general mailing list