URL: <https://savannah.gnu.org/support/?110729>
Summary: m4 processing of large grammars slow Project: Bison Submitter: 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 Originator Email: Open/Closed: Open Discussion Lock: Any Operating System: None _______________________________________________________ Follow-up Comments: ------------------------------------------------------- Date: Tue 20 Sep 2022 07:08:29 PM UTC By: Andres Freund <anarazel> 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 _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/support/?110729> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/