Re: Speed up clean meson builds by ~25% - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Speed up clean meson builds by ~25%
Date
Msg-id 20240410000351.uqiogavry6kwqokg@awork3.anarazel.de
Whole thread Raw
In response to Re: Speed up clean meson builds by ~25%  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Speed up clean meson builds by ~25%
List pgsql-hackers
Hi,

On 2024-04-09 19:44:03 -0400, Tom Lane wrote:
> I experimented with replacing mm_strdup() with
>
> #define mm_strdup(x) (x)
>
> As you did, I wasn't trying to get to a working result, so I didn't do
> anything about removing all the free's or fixing the cast-away-const
> warnings.  The result was disappointing though.  On my Mac laptop
> (Apple clang version 15.0.0), the compile time for preproc.o went from
> 6.7sec to 5.5sec.  Which is better, but not enough better to persuade
> me to do all the janitorial work of restructuring ecpg's
> string-slinging.  I think we haven't really identified the problem.

With what level of optimization was that?  It kinda looks like their version
might be from before the worst of the issue...


FWIW, just redefining mm_strdup() that way doesn't help much here either,
even with an affected compiler. The gain increases substantially after
simplifying unreserved_keyword etc to just use the default action.

I think having the non-default actions for those branches leaves you with a
similar issue, each of the actions just set a register, storing that and going
to the loop iteration is the same.

FWIW:
                               clang-19 -O2
"plain"                        0m24.354s
mm_strdup redefined            0m23.741s
+use default action            0m14.218s

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: "an SQL" vs. "a SQL"
Next
From: Tom Lane
Date:
Subject: Re: Speed up clean meson builds by ~25%