From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a6b:a112:: with SMTP id k18-v6mr3360181ioe.138.1528053279494; Sun, 03 Jun 2018 12:14:39 -0700 (PDT) X-Received: by 2002:a9d:276e:: with SMTP id r101-v6mr414863ota.9.1528053278941; Sun, 03 Jun 2018 12:14:38 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.uzoreto.com!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!v8-v6no4414377itc.0!news-out.google.com!b185-v6ni4807itb.0!nntp.google.com!u74-v6no4419235itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 3 Jun 2018 12:14:38 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=76.218.37.33; posting-account=W2gdXQoAAADxIuhBWhPFjUps3wUp4RhQ NNTP-Posting-Host: 76.218.37.33 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: generating and compiling a very large file From: Stephen Leake Injection-Date: Sun, 03 Jun 2018 19:14:39 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:52886 Date: 2018-06-03T12:14:38-07:00 List-Id: I'm working on a parser generator. One of the files generated is very large= ; 20,000 lines. They build the LALR parse table with code like this: Table.States (1291).Productions :=3D WisiToken.To_Vector ((1 =3D> 185= )); Add_Action (Table.States (1291), (19, 20), 4, 589); Add_Action (Table.States (1291), (1 =3D> 528), 5, 590); Add_Action (Table.States (1291), 13, Reduce, 66, 132, 0, 0, null, nul= l); Add_Action (Table.States (1291), (1 =3D> 80), 15, 591); Add_Action (Table.States (1291), 17, Reduce, 66, 132, 0, 0, null, nul= l); Add_Action (Table.States (1291), (150, 151), 18, 592); Add_Action (Table.States (1291), 24, Reduce, 515, 304, 0, 0, null, nu= ll); Add_Action (Table.States (1291), 26, Reduce, 515, 304, 0, 0, null, nu= ll); Add_Action (Table.States (1291), (209, 210), 27, 593); Add_Action (Table.States (1291), 28, Reduce, 66, 132, 0, 0, null, nul= l); Add_Action (Table.States (1291), (1 =3D> 523), 31, 595); Add_Action (Table.States (1291), (296, 297, 298, 299), 32, 596); Add_Action (Table.States (1291), 37, Reduce, 66, 132, 0, 0, null, nul= l); Add_Action (Table.States (1291), (1 =3D> 520), 41, 597); Add_Action (Table.States (1291), (409, 410, 411), 48, 7); Add_Action (Table.States (1291), (449, 450, 451), 52, 598); Add_Action (Table.States (1291), (487, 488), 57, 599); Add_Action (Table.States (1291), (224, 225, 519), 58, 600); Add_Action (Table.States (1291), (54, 114, 497, 498, 567), 61, 601); Add_Action (Table.States (1291), 73, Reduce, 66, 132, 0, 0, null, nul= l); Add_Action (Table.States (1291), (1 =3D> 285), 93, 603); Add_Action (Table.States (1291), (65, 357), 104, 604); Add_Action (Table.States (1291), (1 =3D> 364), 105, 48); Add_Action (Table.States (1291), (1 =3D> 358), 106, 49); Add_Error (Table.States (1291)); Add_Goto (Table.States (1291), 112, 113, 605); Add_Goto (Table.States (1291), 521, 123, 606); Add_Goto (Table.States (1291), 512, 126, 607); Add_Goto (Table.States (1291), 361, 128, 50); Add_Goto (Table.States (1291), 67, 131, 608); Add_Goto (Table.States (1291), 68, 132, 609); Add_Goto (Table.States (1291), 110, 133, 610); Add_Goto (Table.States (1291), 108, 139, 611); Add_Goto (Table.States (1291), 538, 151, 612); Add_Goto (Table.States (1291), 511, 152, 613); Add_Goto (Table.States (1291), 527, 162, 614); Add_Goto (Table.States (1291), 522, 191, 615); Add_Goto (Table.States (1291), 111, 197, 616); Add_Goto (Table.States (1291), 536, 218, 617); Add_Goto (Table.States (1291), 185, 219, 1294); Add_Goto (Table.States (1291), 107, 223, 619); Add_Goto (Table.States (1291), 109, 236, 620); Add_Goto (Table.States (1291), 45, 243, 621); Add_Goto (Table.States (1291), 530, 261, 622); Add_Goto (Table.States (1291), 524, 265, 623); Add_Goto (Table.States (1291), 363, 276, 53); Add_Goto (Table.States (1291), 529, 280, 624); Add_Goto (Table.States (1291), 526, 294, 625); Add_Goto (Table.States (1291), 360, 297, 54); Add_Goto (Table.States (1291), 509, 298, 626); Add_Goto (Table.States (1291), 113, 302, 627); Add_Goto (Table.States (1291), 514, 303, 628); Add_Goto (Table.States (1291), 286, 304, 629); Add_Goto (Table.States (1291), 525, 306, 630); Add_Goto (Table.States (1291), 537, 307, 631); Add_Goto (Table.States (1291), 513, 310, 632); Add_Goto (Table.States (1291), 510, 327, 633); On my 64bit 32GB ram Windows box running GNAT GPL 2017, this takes 1.5 minu= tes to compile; slow, but acceptable since I don't compile it very often. I= n a Debian 8 VM on that same box, allocated 1 GB ram, it takes 11 minutes. = I can allocate more ram to that VM, but 1 GB is enough for everything else = I do in it, and other people who might use this have slow/small machines. Is there anything I can do to the code to shorten the compile time? I have = complete control over this; for example, I could combine all those Add_Goto= statements into one line. A more drastic change would be to put all the numbers in a text file, read = in at run time. I haven't tried that yet, mostly because some of those 'nul= l' values are procedure'access in other parts of the file. I'm hoping someone here has hit this problem before, and has some helpful s= olutions :). -- Stephe