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>, PG Hackers <pgsql-hackers@postgresql.org>
Date: 2011-12-02T01:29:56Z
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 1 December 2011 17:15, Robert Haas <robertmhaas@gmail.com> wrote: > One thing I'm starting to get a bit concerned about is the effect of > this patch on the size of the resulting binary. The performance > results you've posted are getting steadily more impressive as you get > into this, which is cool, but it seems like the number of copies of > the qsort logic that you're proposing to include in the resulting > binary is also steadily climbing. On my system, a stripped postgres > binary built with my usual compile options (except --enable-cassert, > which I took out) is 49336 bytes bigger with this patch applied, an > increase of close to 1%. Do your usual compile options include debug symbols? I've been using standard compile options for development of this patch, for obvious reasons. I get 36690 bytes (just under 36 KiB, or a 0.644% increase). Binary bloat is a legitimate concern. I thought that I was conservative in my choice of specialisations though. > We might need to be a little bit choosy > about this, because I don't think that we want to end up with a > situation where some noticeable percentage of the final binary > consists of differently-inlined versions of the quicksort algorithm - > especially because there may be other places where we want to do > similar kinds of inlining. > > Thoughts? A simple caveat in a comment along the lines of "this mechanism instantiates 2 copies of qsort_arg per type, please use judiciously" sounds like the right balance. It could also be possible to be penny wise and pound foolish here though. -- Peter Geoghegan http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training and Services