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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-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 Content-Type Size
geqo-3.patch text/x-patch 3.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Copeland 2002-10-07 21:18:36 Re: Analysis of ganged WAL writes
Previous Message Curtis Faith 2002-10-07 21:06:47 Re: Analysis of ganged WAL writes

Browse pgsql-patches by date

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