Re: qsort again (was Re: Strange Create Index

Поиск
Список
Период
Сортировка
От Steinar H. Gunderson
Тема Re: qsort again (was Re: Strange Create Index
Дата
Msg-id 20060216113522.GA3461@uio.no
обсуждение исходный текст
Ответ на Re: qsort again (was Re: Strange Create Index  (Ron <rjpeace@earthlink.net>)
Ответы Re: qsort again (was Re: Strange Create Index  (Ron <rjpeace@earthlink.net>)
Re: qsort again (was Re: Strange Create Index  (Neil Conway <neilc@samurai.com>)
Список pgsql-performance
On Wed, Feb 15, 2006 at 11:30:54PM -0500, Ron wrote:
> Even better (and more easily scaled as the number of GPR's in the CPU
> changes) is to use
> the set {L; L+1; L+2; t>>1; R-2; R-1; R}
> This means that instead of 7 random memory accesses, we have 3; two
> of which result in a
> burst access for three elements each.

Isn't that improvement going to disappear competely if you choose a bad
pivot?

> SIDE NOTE: IIRC glibc's qsort is actually merge sort.  Merge sort
> performance is insensitive to all inputs, and there are way to
> optimize it as well.

glibc-2.3.5/stdlib/qsort.c:

  /* Order size using quicksort.  This implementation incorporates
     four optimizations discussed in Sedgewick:

I can't see any references to merge sort in there at all.

/* Steinar */
--
Homepage: http://www.sesse.net/

В списке pgsql-performance по дате отправления:

Предыдущее
От: "Gary Doades"
Дата:
Сообщение: Re: [HACKERS] qsort again (was Re: Strange Create Index
Следующее
От: Florian Weimer
Дата:
Сообщение: Re: [HACKERS] qsort again