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!news1.google.com!border1.nntp.dca.giganews.com!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: Tue, 01 Sep 2009 05:48:51 -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> <4a9ce98b$0$30226$9b4e6d93@newsspool1.arcor-online.net> From: Ole-Hjalmar Kristensen Organization: Sun Microsystems Date: 01 Sep 2009 12:48:50 +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-2cSNOTsUzjpbpyZrhJetIEEnOC1NES4MFglfPaao71vmzOmaokmNkH3EfFGiR7OQt1yHDYj0pfEThse!8baEsF/kP0AYpuKNpgKPZ34ip6ODMnxcV6d9boGFaRKW6soWsymAzB9B 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 X-Original-Bytes: 3215 Xref: g2news2.google.com comp.lang.ada:8096 Date: 2009-09-01T12:48:50+02:00 List-Id: >>>>> "GB" == Georg Bauhaus writes: OK, I see. In GNAT, the stream_io is a relatively thin layer on top of the C streams, isn't it? So you will get essentially the same speed as the C standard IO library. But does Stream_Io have a version of get_line? I know the C streams interface has a binding to fgets, but that is just using fgets directly. How did you read line by line with Stream_Io? The only way I can think of to improve on fgets is to get rid of the copying, but would you then strictly be reading line by line? I am thinking of something like procedure get_line(buffer : in out string; first : out natural; last :out natural); This get_line would only need to copy when it encounters a string which extends past the end of the buffer, in the normal case it would only return the indices of the slice. GB> Ole-Hjalmar Kristensen schrieb: >> I see the C++ version uses fgets, which is a reasonably fast way of >> getting a line. Is there any reason not to use fgets? >> fgets (OpenSolaris version) uses memccpy to actually copy the buffer >> until the newline: GB> There were two reasons not to import fgets: GB> 1 - fgets turns out not to be faster than Stream_IO. GB> 2 - It's C. ;-) GB> The fasta entry at the Shootout which uses Unchecked_Conversion, GB> not 'Address could even be improved a small bit if we change GB> it to use 'Address. But then, this adds to the line count. GB> Is it worth it, for a shorter program? GB> There was a discussion leading to this GB> (<4a7b4daa$0$31333$9b4e6d93@newsspool4.arcor-online.net>) GB> early in August. -- C++: The power, elegance and simplicity of a hand grenade.