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=ham 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!news2.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx02.iad01.newshosting.com!newshosting.com!novia!border2.nntp.dca.giganews.com!nntp.giganews.com!backlog2.nntp.dca.giganews.com!nntp.sun.com!news.sun.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 02 Sep 2009 06:07:05 -0500 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> <4a9e3051$0$30220$9b4e6d93@newsspool1.arcor-online.net> From: Ole-Hjalmar Kristensen Organization: Sun Microsystems Date: 02 Sep 2009 13:07:02 +0200 Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cache-Post-Path: news1nwk!unknown@khepri42.norway.sun.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-wyhI6ALTu7FyxFfqh+Bh9+iKS6ZqTnkz3JlDFLmPX1mSMkTQsCJM6utx8Y2fzKA9DBkKS1sLmIzPnkv!ccmeMtBJH/MleQ5JQkhU1B1qWQ0KeVZdH2c0K4dm4UX9nwikshYw9PmG X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.39 Xref: g2news2.google.com comp.lang.ada:8109 Date: 2009-09-02T13:07:02+02:00 List-Id: >>>>> "GB" == Georg Bauhaus writes: GB> 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. GB> It looks like copying In_Buf(Start..I-1) be circumvented. GB> I have added a solution to Line_IO. GB> read() performance vs. Stream_IO.Read performance seems GB> to depend on the OS. On a Mac here, read() is faster. GB> On Ubuntu, Stream_IO.Read is faster. Strange. I cannot really imagine how Stream_IO.Read is faster since it has to do the system call to do the actual read anyway. One possibility is that In_Buf is not properly aligned, so that read() into In_Buf is slower than the equivalent read() into the C stdio buffers. The system call should be the same in any case. GB> There is an issue with GNATs and End_File (GNATs other GB> than I guess the one you have). When comparing N <= 0, GB> ``operator for type "System.Crtl.size_t" is not GB> directly visible''. To work around this, I wrote GB> function End_File return Boolean is GB> type Size_T is mod 2**Standard'Address_Size; GB> N0 : constant Size_T := Size_T(N); GB> Zero : constant Size_T := 0; GB> begin GB> return N0 <= Zero; GB> end End_File; Yes. I was using an old version of GNAT. GB> Finally, I think Get_Line_Test can be made more portable among Unix GB> compilers by changing GNAT specific Interfaces.C_Streams GB> into Interfaces.C; Could be slightly less convenient to GB> write, though? I only included Interfaces.C_Streams because it was a convenient place to get hold of the types needed to import the read() function, so if you find them in Interfaces.C, that's just fine. -- C++: The power, elegance and simplicity of a hand grenade.