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,FREEMAIL_FROM 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!n11g2000yqb.googlegroups.com!not-for-mail From: jonathan Newsgroups: comp.lang.ada Subject: Re: Ada Shootout program for K-Nucleotide (patches) Date: Thu, 13 Aug 2009 14:30:14 -0700 (PDT) Organization: http://groups.google.com Message-ID: <328425fe-68a4-413a-9708-bade25de65ea@n11g2000yqb.googlegroups.com> References: <4a743343$0$32674$9b4e6d93@newsspool2.arcor-online.net> <87bpmxdqfo.fsf@nbi.dk> <2bae762e-0d8a-4389-843a-466e87f59fd1@a37g2000prf.googlegroups.com> <4a786b15$0$30230$9b4e6d93@newsspool1.arcor-online.net> <67e76046-62d4-4c0e-bdd8-8d00cdf93bca@l35g2000pra.googlegroups.com> <4a79f712$0$31874$9b4e6d93@newsspool3.arcor-online.net> <7a5aea9c-1ade-4d73-98ef-08d226823161@z31g2000yqd.googlegroups.com> <4a7a0826$0$31862$9b4e6d93@newsspool3.arcor-online.net> <4a7a96a2$0$31867$9b4e6d93@newsspool3.arcor-online.net> <4a7b4daa$0$31333$9b4e6d93@newsspool4.arcor-online.net> <211a9019-6b96-431d-a634-e399075110ec@t13g2000yqt.googlegroups.com> NNTP-Posting-Host: 143.117.23.126 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1250199014 9753 127.0.0.1 (13 Aug 2009 21:30:14 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 13 Aug 2009 21:30:14 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: n11g2000yqb.googlegroups.com; posting-host=143.117.23.126; posting-account=Jzt5lQoAAAB4PhTgRLOPGuTLd_K1LY-C User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:1.9.0.12) Gecko/2009072220 Iceweasel/3.0.6 (Debian-3.0.6-1),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7747 Date: 2009-08-13T14:30:14-07:00 List-Id: On Aug 13, 9:56=A0pm, jonathan wrote: > On Aug 6, 10:39=A0pm, Georg Bauhaus > > > bug.bauh...@maps.futureapps.de> wrote: > > Georg Bauhaus wrote: > > > Jeffrey R. Carter schrieb: > > >> Georg Bauhaus wrote: > > >>> Terribly slow. =A0Requesting only a tenth of the required amount > > >>> (i.e. N =3D 2500000) has taken ~30s. By extrapolation the full > > >>> set is produced only after ~5m. That's almost 20x slower > > >>> than the original Ada.Text_IO. > > > >>> (The RM explains that String'Write calls procedure > > >>> Character'Write for each component of the String...) > > >> What about if you unchecked convert the String into an appropriately > > >> sized Stream_Element_Array and write it? > > > > A similar thing is done in florist AFAICS; I'm working > > > on it. > > > A new fasta program using Ada's Stream_IO is here: > > >http://home.arcor.de/bauhaus/Ada/fasta.ada > > > It is pleasantly fast, even a bit quicker than > > calling the C functions as previously explained. > > Good to stay inside Ada. > > > A stylistic issue: > > The new Print procedure is currently written using > > named parameter association and package prefixes. > > This makes it differ from the rest of the program. > > Should it be made a better match? > > FWIW, I finally found time to experiment with compiler flags > on my x86_64 GNU/Linux pc. I used GNAT GPL =A02009 (gcc 4.3.4). > > fasta =A0 running times: > > with -gnatN =A0 =A0 =A0 =A0 get 20% to 25% speedup (NOT -gnatn) > with -funroll-loops get 4% to 5% speedup (NOT -funroll-all-loops) > with -O2 same running time (almost) as -O3 > > and if you change > > =A0 =A0Last : Natural :=3D 42; > > to > > =A0 =A0type Unsigned_32 is mod 2**32; > =A0 =A0Last : Unsigned_32 :=3D 42; > > get 10% speedup! (I bet arithmetic on Natural is 64 bit; > likely same will happen on some of the shootout benchmarks.) As soon as I posted this I decided to test -ffast-math, which usually doesn't do much. Here it gave a spendid speedup of about 10% to 15%. (There's a bit of floating point in fasta). Overall, we seem to get a roughly 25-30% speedup from optimization switches alone (ok, plus a bit from the 32 bit modular type). In other words gnatmake -gnatNp -O3 -funroll-loops -ffast-math -march=3Dnative fasta.adb produced an executable that ran in ~75% the running time of gnatmake -gnatp -O3 -march=3Dnative fasta.adb Oh, and the infamous -a flag gave another 2% speedup. I won't even speculate. Jonathan