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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,3a6a9f1d654285ba X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder.news-service.com!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Wed, 02 Sep 2009 10:44:01 +0200 From: Georg Bauhaus Reply-To: rm.tsoh+bauhaus@maps.futureapps.de User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada Shootout program for K-Nucleotide (patches) References: <4a743343$0$32674$9b4e6d93@newsspool2.arcor-online.net> <0c18b36c-7af0-454c-8208-9b0416111a1f@w41g2000yqb.googlegroups.com> <4a758ce2$0$31338$9b4e6d93@newsspool4.arcor-online.net> <4a967b33$0$32671$9b4e6d93@newsspool2.arcor-online.net> <4a9d06b9$0$30234$9b4e6d93@newsspool1.arcor-online.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <4a9e3051$0$30220$9b4e6d93@newsspool1.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 02 Sep 2009 10:44:01 CEST NNTP-Posting-Host: 691630b5.newsspool1.arcor-online.net X-Trace: DXC=``L\GX;XcEH2jYf>V4L0gLic==]BZ:afN4Fo<]lROoRA^YC2XCjHcbIVNJKER]6RaCA:ho7QcPOVCRL^N`YEnmVHDU<1[A?kM6L X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:8107 Date: 2009-09-02T10:44:01+02:00 List-Id: Ole-Hjalmar Kristensen wrote: >>>>>> "GB" == Georg Bauhaus writes: > > I think the problem is not the explicit copy which happens when we hit > the end of the buffer (easily verified, just increase the buffer size > 10 times, the copying will happen 1/10 of the time, but execution time > stays the same), but the implicit copy which seems to happen in the statement > return In_Buf(Start..I-1); I do not know if this copy is unavoidable, > or if the compiler could have optimized it away. It looks like copying In_Buf(Start..I-1) be circumvented. I have added a solution to Line_IO. read() performance vs. Stream_IO.Read performance seems to depend on the OS. On a Mac here, read() is faster. On Ubuntu, Stream_IO.Read is faster. There is an issue with GNATs and End_File (GNATs other than I guess the one you have). When comparing N <= 0, ``operator for type "System.Crtl.size_t" is not directly visible''. To work around this, I wrote function End_File return Boolean is type Size_T is mod 2**Standard'Address_Size; N0 : constant Size_T := Size_T(N); Zero : constant Size_T := 0; begin return N0 <= Zero; end End_File; Finally, I think Get_Line_Test can be made more portable among Unix compilers by changing GNAT specific Interfaces.C_Streams into Interfaces.C; Could be slightly less convenient to write, though?