Re: Inlining comparators as a performance optimisation
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Geoghegan <peter@2ndquadrant.com>
Cc: PG Hackers <pgsql-hackers@postgresql.org>
Date: 2011-09-20T02:51:32Z
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
Peter Geoghegan <peter@2ndquadrant.com> writes: > Once the cache has been warmed, explain analyze very consistently > reports a runtime of 123ms for this query on master/HEAD, which varies > +/- 1 ms, with a few outliers of maybe +/- 2ms. However, when I apply > this patch, that goes down to 107ms +/- 1ms at -O0. I think that > that's a pretty good start. Funnily enough, the difference/advantage > vanishes at -O2 (I'm guessing that the higher optimisation level of > GCC 4.5 hyper-corrects away the inlining, but I don't have time to > check that right now). Considering that -O2 is our standard optimization level, that observation seems to translate to "this patch will be useless in practice". I think you had better investigate that aspect in some detail before spending more effort. > This performance patch differs from most in that it's difficult in > principle to imagine a performance regression occurring. Really? N copies of the same code could lead to performance loss just due to code bloat (ie, less of a query's inner loops fitting in CPU cache). Not to mention the clear regression in maintainability. So I'm disinclined to consider this sort of change without a significantly bigger win than you're suggesting above (no, I don't even consider the -O0 number attractive, let alone what you're finding at -O2). regards, tom lane