Re: Raising our compiler requirements for 9.6

From: Andres Freund <andres(at)anarazel(dot)de>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Raising our compiler requirements for 9.6
Date: 2015-08-05 13:46:36
Message-ID: 20150805134636.GF12598@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2015-08-05 15:08:29 +0200, Andres Freund wrote:
> We might later want to change some of the harder to maintain macros to
> inline functions, but that seems better done separately.

Here's a conversion for fastgetattr() and heap_getattr(). Not only is
the resulting code significantly more readable, but the conversion also
shrinks the code size:

$ ls -l src/backend/postgres_stock src/backend/postgres
-rwxr-xr-x 1 andres andres 37054832 Aug 5 15:18 src/backend/postgres_stock
-rwxr-xr-x 1 andres andres 37209288 Aug 5 15:23 src/backend/postgres

$ size src/backend/postgres_stock src/backend/postgres
text data bss dec hex filename
7026843 49982 298584 7375409 708a31 src/backend/postgres_stock
7023851 49982 298584 7372417 707e81 src/backend/postgres

stock is the binary compiled without the conversion.

A lot of the size difference is debugging information (which now needs
less duplicated information on each callsite), but you can see that the
text section (the actual executable code) shrank by 3k.

stripping the binary shows exactly that:
-rwxr-xr-x 1 andres andres 7076760 Aug 5 15:44 src/backend/postgres_s
-rwxr-xr-x 1 andres andres 7079512 Aug 5 15:45 src/backend/postgres_stock_s

To be sure this doesn't cause problems I ran a readonly pgbench. There's
a very slight, but reproducible, performance benefit. I don't think
that's a reason for the change, I just wanted to make sure there's no
regressions.

Regards,

Andres

Attachment Content-Type Size
0001-Convert-fastgetattr-and-heap_getattr-into-inline-fun.patch text/x-patch 8.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-08-05 14:08:10 Re: Raising our compiler requirements for 9.6
Previous Message Robert Haas 2015-08-05 13:08:52 Re: Reduce ProcArrayLock contention