Re: Inlining comparators as a performance optimisation
Peter Geoghegan <peter@2ndquadrant.com>
From: Peter Geoghegan <peter@2ndquadrant.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Bruce Momjian <bruce@momjian.us>, PG Hackers <pgsql-hackers@postgresql.org>
Date: 2011-12-07T11:57:08Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Speed up conversion of signed integers to C strings.
- 4fc115b2e981 9.1.0 cited
-
Remove some unnecessary tests of pgstat_track_counts.
- f4d242ef9473 9.1.0 cited
-
Remove cvs keywords from all files.
- 9f2e21138693 9.1.0 cited
-
Code cleanup for function prototypes: change two K&R-style prototypes
- b9954fbb4ef2 8.3.0 cited
-
Use Min() instead of min() in qsort, for consistency and to avoid
- b38900c76776 8.2.0 cited
-
pgindent run for 8.2.
- f99a569a2ee3 8.2.0 cited
-
Switch over to using our own qsort() all the time, as has been proposed
- 6edd2b4a91bd 8.2.0 cited
On 7 December 2011 03:45, Robert Haas <robertmhaas@gmail.com> wrote: > In this regard, I think Heikki's remarks upthread are worth some > thought. If inlining is a win just because it avoids saving and > restoring registers or allows better instruction scheduling, then > inlining is the (probably?) the only way to get the benefit. But if > most of the benefit is in having a separate path for the > single-sort-key case, we can do that without duplicating the qsort() > code and get the benefit for every data type without much code bloat. > I'd like to see us dig into that a little, so that we get the broadest > possible benefit out of this work. It doesn't bother me that not > every optimization will apply to every case, and I don't object to > optimizations that are intrinsically narrow (within some reasonable > limits). But I'd rather not take what could be a fairly broad-based > optimization and apply it only narrowly, all things being equal. I think we're in agreement then. It's important to realise, though I'm sure you do, that once you've done what I did with sorting single scanKey integers, that's it - there isn't really any way that I can think of to speed up quick sorting further, other than parallelism which has major challenges, and isn't particularly appropriate at this granularity. The real significance of inlining is, well, that's it, that's all there is - after inlining, I predict that the well will run dry, or practically dry. Inlining actually is a pretty great win when you look at sorting in isolation, but it's just that there's been a number of other significant wins in my patch, and of course there is overhead from a number of other areas, so perhaps it's easy to lose sight of that. -- Peter Geoghegan http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training and Services