Re: Double sorting split patch

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: Double sorting split patch
Дата
Msg-id CAEYLb_UmjBFymMPBGmpNNAE-vY6qZtyey62XX_=e6XuuWzYoqg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Double sorting split patch  (Alexander Korotkov <aekorotkov@gmail.com>)
Ответы Re: Double sorting split patch
Список pgsql-hackers
On 15 September 2011 19:46, Alexander Korotkov <aekorotkov@gmail.com> wrote:
> Proposed algorithm finds following splits by single pass on two arrays: one
> sorted by lower bound of interval and another sorted by upper bound of
> interval.

Have you considered if further performance improvements could come
from providing a qsort implementation that allows for the inlining of
the comparator? I find it curious that we go to the trouble of
providing a custom qsort implementation in qsort.c, pg_qsort, but
haven't gone one step further and considered inlining effects. Here's
a macro-based inlining implementation:

http://www.corpit.ru/mjt/qsort.html

I wondered in passing if compiler vendors had got around to figuring
out a way of solving the "inlining function pointer" problem that I
first read about years ago, so I ran this code, which benchmarks the
macro-based qsort above:

http://www.lemoda.net/c/inline-qsort-example/index.html

It's actually C++, but that isn't significant (c stdlib qsort() is
called). When I built this code with GCC 4.5, the results were:

C quick-sort time elapsed: 3.24
Inline C quick-sort time elapsed: 2.01

It looks like this is something that could be revisited.

--
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services


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

Предыдущее
От: Alexander Korotkov
Дата:
Сообщение: Re: Double sorting split patch
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Is there really no interest in SQL Standard?