Re: [HACKERS] qsort again - Mailing list pgsql-performance

From Martijn van Oosterhout
Subject Re: [HACKERS] qsort again
Date
Msg-id 20060216124918.GE26127@svana.org
Whole thread Raw
In response to Re: [HACKERS] qsort again  (Florian Weimer <fw@deneb.enyo.de>)
Responses Re: [HACKERS] qsort again  (Sven Geisler <sgeisler@aeccom.com>)
List pgsql-performance
On Thu, Feb 16, 2006 at 01:10:48PM +0100, Florian Weimer wrote:
> * Neil Conway:
>
> > On Wed, 2006-02-15 at 18:28 -0500, Tom Lane wrote:
> >> It seems clear that our qsort.c is doing a pretty awful job of picking
> >> qsort pivots, while glibc is mostly managing not to make that mistake.
> >> I haven't looked at the glibc code yet to see what they are doing
> >> differently.
> >
> > glibc qsort is actually merge sort, so I'm not surprised it avoids this
> > problem.
>
> qsort also performs twice as many key comparisons as the theoretical
> minimum.  If key comparison is not very cheap, other schemes (like
> heapsort, for example) are more attractive.

Last time around there were a number of different algorithms tested.
Did anyone run those tests while getting it to count the number of
actual comparisons (which could easily swamp the time taken to do the
actual sort in some cases)?

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment

pgsql-performance by date:

Previous
From: Florian Weimer
Date:
Subject: Re: [HACKERS] qsort again
Next
From: Sven Geisler
Date:
Subject: Re: [HACKERS] qsort again