mainBison - Support: sr #110729, m4 processing of large grammars...

 
 

sr #110729: m4 processing of large grammars slow

Submitter:  Andres Freund <anarazel>
Submitted:  Tue 20 Sep 2022 07:08:29 PM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 20 Sep 2022 07:08:29 PM UTC, original submission:  

Hi,

translating postgres' bison grammars these days is the slowest build step of building postgres. Interestingly enough the time isn't even spent building the state machine or such, it's nearly all in m4.

Here's an example with postgres' main grammar. While there are other grammars that are slower to build, they require prior build steps.

curl -o gram.y 'https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/parser/gram.y;hb=HEAD'
$ /usr/bin/bison --trace=time -Wno-deprecated -o gram.c -d gram.y
bison (GNU Bison) 3.8.2
Execution times (seconds)
                          CPU user      CPU system    wall clock     
 reader                   0.044 ( 2%)   0.000 ( 0%)   0.044988 ( 2%)
 LR(0)                    0.038 ( 2%)   0.000 ( 0%)   0.038423 ( 2%)
 LALR(1)                  0.083 ( 4%)   0.003 (16%)   0.086182 ( 4%)
 parser action tables     0.149 ( 7%)   0.000 ( 0%)   0.149236 ( 7%)
 outputting parser        0.075 ( 3%)   0.003 (16%)   0.119665 ( 6%)
 running m4               1.518 (79%)   0.013 (66%)   1.454934 (76%)
 total time               1.914         0.020         1.900101

On slow systems this often ends up > 10s.

I don't know anything about m4, but perhaps there's something that can be done to speed this step up?

Regards,

Andres

Andres Freund <anarazel>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by anarazel (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code