Re: Inlining comparators as a performance optimisation
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
From: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
To: Simon Riggs <simon@2ndQuadrant.com>
Cc: Peter Geoghegan <peter@2ndquadrant.com>, Tom Lane <tgl@sss.pgh.pa.us>, PG Hackers <pgsql-hackers@postgresql.org>
Date: 2011-09-21T07:08:42Z
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 21.09.2011 10:01, Simon Riggs wrote: > On Wed, Sep 21, 2011 at 7:51 AM, Heikki Linnakangas > <heikki.linnakangas@enterprisedb.com> wrote: >> On 21.09.2011 02:53, Peter Geoghegan wrote: >>> >>> C stdlib quick-sort time elapsed: 2.092451 seconds >>> Inline quick-sort time elapsed: 1.587651 seconds >>> >>> Does *that* look attractive to you? >> >> Not really, to be honest. That's a 25% speedup in pure qsorting speed. How >> much of a gain in a real query do you expect to get from that, in the best >> case? There's so many other sources of overhead that I'm afraid this will be >> lost in the noise. If you find a query that spends, say, 50% of its time in >> qsort(), you will only get a 12.5% speedup on that query. And even 50% is >> really pushing it - I challenge you to find a query that spends any >> significant amount of time qsorting integers. > > How about almost every primary index creation? Nope. Swamped by everything else. Also note that as soon as the sort grows big enough to not fit in maintenance_work_mem, you switch to the external sort algorithm, which doesn't use qsort. Perhaps you could do similar inlining in the heap sort & merge passes done in the external sort, but it's unlikely to be as big a win there. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com