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 20150811110448.GB17575@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  (Noah Misch <noah@leadboat.com>)
Re: Raising our compiler requirements for 9.6  (Noah Misch <noah@leadboat.com>)
List pgsql-hackers
On 2015-08-05 15:46:36 +0200, Andres Freund wrote:
> 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.

Slightly updated version attached. The only changes are updates to some
comments referencing the 'fastgetattr macro' and the like. Oh, and an
additional newline.

In my opinion this drastically increases readability and thus should be
applied. Will do so sometime tomorrow unless there's protest.

Btw, I found that many changes are much more readable when changing
git's config to use histogramm diffs (git config --global diff.algorithm
histogram or --histogram).

Regards,

Andres

Attachment

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Reducing ClogControlLock contention
Next
From: Anastasia Lubennikova
Date:
Subject: Re: How to compare different datums within from a tuple?