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

From Tom Lane
Subject Re: Speed up clean meson builds by ~25%
Date
Msg-id 3883695.1712703641@sss.pgh.pa.us
Whole thread Raw
In response to Re: Speed up clean meson builds by ~25%  (Andres Freund <andres@anarazel.de>)
Responses Re: Speed up clean meson builds by ~25%
List pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> I think we need to do something about the compile time of this file, even with
> gcc. Our main grammar already is an issue and stacking all the ecpg stuff on
> top makes it considerably worse.

Seems reasonable, if we can.

> Why are strduping all of these?

IIRC, the issue is that the mechanism for concatenating the tokens
back together frees the input strings

static char *
cat2_str(char *str1, char *str2)
{
    char * res_str    = (char *)mm_alloc(strlen(str1) + strlen(str2) + 2);

    strcpy(res_str, str1);
    if (strlen(str1) != 0 && strlen(str2) != 0)
        strcat(res_str, " ");
    strcat(res_str, str2);
    free(str1);          <------------------
    free(str2);          <------------------
    return res_str;
}

So that ought to dump core if you don't make all the productions
return malloc'd strings.  How did you work around that?

(Maybe it'd be okay to just leak all the strings?)

            regards, tom lane



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Allow non-superuser to cancel superuser tasks.
Next
From: Alexander Korotkov
Date:
Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands