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 Path: g2news2.google.com!postnews.google.com!w41g2000yqb.googlegroups.com!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: Ada Shootout program for K-Nucleotide (patches) Date: Sat, 1 Aug 2009 08:21:41 -0700 (PDT) Organization: http://groups.google.com Message-ID: <0c18b36c-7af0-454c-8208-9b0416111a1f@w41g2000yqb.googlegroups.com> References: <4a743343$0$32674$9b4e6d93@newsspool2.arcor-online.net> NNTP-Posting-Host: 94.108.156.230 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1249140101 8875 127.0.0.1 (1 Aug 2009 15:21:41 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 1 Aug 2009 15:21:41 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: w41g2000yqb.googlegroups.com; posting-host=94.108.156.230; posting-account=pcLQNgkAAAD9TrXkhkIgiY6-MDtJjIlC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.11) Gecko/2009061208 Iceweasel/3.0.9 (Debian-3.0.9-1),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7505 Date: 2009-08-01T08:21:41-07:00 List-Id: Georg Bauhaus wrote on comp.lang.ada: > This is about the K-Nucleotide program at the > Computer Language Benchmark Game,http://shootout.alioth.debian.org/u32/be= nchmark.php?test=3Dknucleotide&... > where some Ada programs have started to fail. > > In order to have one of them work again, I have patched > knucleotide.gnat, with some success. =A0New version is here:http://home.a= rcor.de/bauhaus/Ada/knucleotide.gnat > > Comments? =A0Does it work on your machine? > > The two changes: > > 1 - [stack exhaustion] a loop reading input lines into an > =A0ubounded =A0string replaces the recursive String "&"ing > =A0procedure. (Noting that the input text file is ~240MB ...) > > 2 - [heavy bounded strings] a lightweight bounded string ADT > =A0replaces an instance of Generic_Bounded_Length, yielding > =A0an improved running time of ~22s down from ~30s for > =A0the 2,500,000 case. > > Still, on a relatively small virtual machine running 64bit > Debian, the program cannot handle the 25,000,000 case. I note that both Martin and yourself use Ada.Text_IO (especially Read_Line) which is notoriously slow. I would use Character'Read and a finite state machine to detect the portion of the input file to be processed, then to fill in the buffer. That should be faster. (the shootout rules state that the program must read "line by line" but that does not make sense since Unix has no concept of a line and all programs must therefore read and parse each byte to detect ends of lines). -- Ludovic Brenta (too busy to help any further, alas).