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-11 11:04:48 |
Message-ID: | 20150811110448.GB17575@awork2.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 | Content-Type | Size |
---|---|---|
0001-Convert-fastgetattr-and-heap_getattr-into-inline-fun.patch | text/x-patch | 8.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Anastasia Lubennikova | 2015-08-11 11:41:22 | Re: How to compare different datums within from a tuple? |
Previous Message | Amit Kapila | 2015-08-11 10:39:51 | Re: Reducing ClogControlLock contention |