Skip site navigation (1) Skip section navigation (2)

inline newNode()

From: Neil Conway <neilc(at)samurai(dot)com>
To: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: inline newNode()
Date: 2002-10-07 21:15:34
Message-ID: 87vg4eosqx.fsf@mailbox.samurai.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
I've been taking a look at improving the performance of the GEQO
code. Before looking at algorithmic improvements, I noticed some
"low-hanging fruit": gprof revealed that newNode() was a hotspot. When
I altered it to be an inline function, the overall time to plan a
12-table table join (using the default GEQO settings) dropped by about
9%. I haven't taken a look at how the patch effects the other places
that use newNode(), but it stands to reason that they'd see a
performance improvement as well (although probably less noticeable).

However, I'm not sure if I used the correct syntax for inlining the
function (since it was originally declared in a header and defined
elsewhere, I couldn't just add 'inline'). The method I used (declaring
the function 'extern inline' and defining it in the header file) works
for me with GCC 3.2, but I'm open to suggestions for improvement.

BTW, after applying the patch, the GEQO profile looks like:

  %   cumulative   self              self     total           
 time   seconds   seconds    calls   s/call   s/call  name
 16.07      0.18     0.18  4618735     0.00     0.00  compare_path_costs
  9.82      0.29     0.11  2149666     0.00     0.00  AllocSetAlloc
  8.04      0.38     0.09   396333     0.00     0.00  add_path
  4.46      0.43     0.05  2149661     0.00     0.00  MemoryContextAlloc
  3.57      0.47     0.04  1150953     0.00     0.00  compare_pathkeys

(Yes, gprof on my machine is still a bit fubared...)

Cheers,

Neil

-- 
Neil Conway <neilc(at)samurai(dot)com> || PGP Key ID: DB3C29FC

Attachment: geqo-3.patch
Description: text/x-patch (3.6 KB)

Responses

pgsql-hackers by date

Next:From: Greg CopelandDate: 2002-10-07 21:18:36
Subject: Re: Analysis of ganged WAL writes
Previous:From: Curtis FaithDate: 2002-10-07 21:06:47
Subject: Re: Analysis of ganged WAL writes

pgsql-patches by date

Next:From: Tom LaneDate: 2002-10-07 21:43:03
Subject: Re: inline newNode()
Previous:From: Peter EisentrautDate: 2002-10-07 19:24:14
Subject: Re: tweak CREATE SEQUENCE grammar

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group