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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b5cd7bf26d091c6f X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!dn9g2000vbb.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Reading the while standard input into a String Date: Tue, 7 Jun 2011 00:32:15 -0700 (PDT) Organization: http://groups.google.com Message-ID: <1142c50a-bf12-4aed-984c-70ba818b4372@dn9g2000vbb.googlegroups.com> References: <1e5e764d-eb7b-4804-8119-b535ddbe5e7e@32g2000vbe.googlegroups.com> <1a84tm53l1wjx.1xdgsbp25vyd5.dlg@40tude.net> NNTP-Posting-Host: 83.3.40.82 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1307431935 11779 127.0.0.1 (7 Jun 2011 07:32:15 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 7 Jun 2011 07:32:15 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: dn9g2000vbb.googlegroups.com; posting-host=83.3.40.82; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUALESNKRC X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:20640 Date: 2011-06-07T00:32:15-07:00 List-Id: On Jun 6, 8:53=A0pm, "Dmitry A. Kazakov" wrote: > > BTW - what about generating debug version of the executable with > > source embedded? > > What for? All you need is source location tags. Which only grow in memory. This means that the concept of dropping the chunks that were already processed is a fiction - it just does not happen, the data is still there in memory, just in some other form. > > In particular, the compiler does not work on potentially > > infinite streams (unlike cat and grep) and there is a clear concept of > > a program structure that has its end. This means that reading the > > whole source file into memory is a perfectly valid approach. > > Wrong. A good example is GNAT compiler which runs out of Windows' 1-2GB > limit when compiling my generics. Macros tend to explode (:-)) They will explode whether you will keep the original source or not. Let me guess - your source code is smaller than 1-2GB, right? Frankly - how big it is in terms of percentage of the total memory used? 1%? Dropping this amount of data (while at the same time complicating the process with additional tags, etc.) as a means of preserving memory is pointless. I bet there are much bigger optimization opportunities in resulting internal data structures. > Memory is cheap, but that does not mean you should waste it. You just do > not need to keep anything but the current source line. And now I would very welcome somebody from existing compiler vendors to hop in and confess how this is *actually* done. :-) -- Maciej Sobczak * http://www.msobczak.com * http://www.inspirel.com