Re: Raising our compiler requirements for 9.6 - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Raising our compiler requirements for 9.6
Date
Msg-id 20150805134636.GF12598@awork2.anarazel.de
Whole thread Raw
In response to Re: Raising our compiler requirements for 9.6  (Andres Freund <andres@anarazel.de>)
Responses Re: Raising our compiler requirements for 9.6  (Andres Freund <andres@anarazel.de>)
Re: Raising our compiler requirements for 9.6  (Bruce Momjian <bruce@momjian.us>)
List 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

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Reduce ProcArrayLock contention
Next
From: Tom Lane
Date:
Subject: Re: Raising our compiler requirements for 9.6