Re: Clang optimiser vs preproc.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Clang optimiser vs preproc.c
Date: 2023-12-16 03:19:56
Message-ID: 3373013.1702696796@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thomas Munro <thomas(dot)munro(at)gmail(dot)com> writes:
> On Sat, Dec 16, 2023 at 3:44 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Thomas Munro <thomas(dot)munro(at)gmail(dot)com> writes:
>>> FYI, it looks like there is a big jump in CPU time to compile preproc.c at -O2:
>>> clang15: ~16s
>>> clang16: ~211s
>>> clang17: ~233s

>> What are the numbers for gram.c?

> clang15: ~3.8s
> clang16: ~3.2s
> clang17: ~2.9s

Huh. There's not that many more productions in the ecpg grammar
than the core, so it doesn't seem likely that this is purely a
size-of-file issue. I'd bet on there being something that clang
doesn't do well about the (very stylized) C code being generated
within the grammar productions.

We actually noticed this or a closely-related problem before [1]
and briefly discussed the possibility of rearranging the generated
code to make it less indigestible to clang. But there was no concrete
idea about what to do specifically, and the thread slid off the radar
screen.

regards, tom lane

[1] https://www.postgresql.org/message-id/20220902174033.wgt6li7oiaxmwftn@awork3.anarazel.de

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2023-12-16 04:30:25 Re: Statistics Import and Export
Previous Message Thomas Munro 2023-12-16 03:04:28 Re: Clang optimiser vs preproc.c