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 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Introductory Presentations, especially aimed at C++ programmers! Date: Wed, 14 Dec 2016 16:48:30 -0600 Organization: JSA Research & Innovation Message-ID: References: <1905815374.502825168.454102.laguest-archeia.com@nntp.aioe.org> <877f7b5llo.fsf@nightsong.com> NNTP-Posting-Host: rrsoftware.com X-Trace: franka.jacob-sparre.dk 1481755710 21926 24.196.82.226 (14 Dec 2016 22:48:30 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Wed, 14 Dec 2016 22:48:30 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-RFC2646: Format=Flowed; Response Xref: news.eternal-september.org comp.lang.ada:32835 Date: 2016-12-14T16:48:30-06:00 List-Id: "Jeffrey R. Carter" wrote in message news:o2q2o6$c16$1@dont-email.me... > On 12/13/2016 04:05 PM, Randy Brukardt wrote: >> >> Conclusion: I don't see any difference between Bob's version and yours in >> terms of dynamic memory allocation needed. > > The difference is that, for every recursive call, the GNAT version > declares 2 buffers, and mine only declares 1. ...and generates a second one implicitly. Still no difference. The semantics of & require a copy, it can't be optimized out (with the possible exception of a direct assignment to something). >From a different message of Jeff's: >... Worrying about the efficiency of very rare situations, given the >general > inefficiency of Text_IO anyway, seems like a waste of time. Customers would disagree with you. I once had to refund a customer because they complained about the efficiency of our Text_IO vs. that of the similar C functions. I spent several weeks redoing Text_IO in part because of that experience (mostly so the performance of Get_Line from files is better). It's very usual that a new customer will write a trial program with their shiny new compiler that just reads some text file with Get_Line. Us old Ada hands know better than to expect great performance from that, but one does not want someone's first impression of Ada to be bad. Thus the performance of Get_Line is one of those things that has to be optimized absolutely as much as possible. (One cannot get into arguments of premature optimization if they are returning their compiler and switching to some other language!!!) Randy. Randy.