From: | Peter Geoghegan <peter(at)2ndquadrant(dot)com> |
---|---|
To: | Alexander Korotkov <aekorotkov(at)gmail(dot)com> |
Cc: | Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Double sorting split patch |
Date: | 2011-09-17 20:09:08 |
Message-ID: | CAEYLb_UmjBFymMPBGmpNNAE-vY6qZtyey62XX_=e6XuuWzYoqg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 15 September 2011 19:46, Alexander Korotkov <aekorotkov(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2011-09-17 22:57:34 | Re: Is there really no interest in SQL Standard? |
Previous Message | Alexander Korotkov | 2011-09-17 17:36:27 | Re: Double sorting split patch |