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@xxxxxxxxx> 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:
signature.asc
Description: Digital signature