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,13280cdb905844e4 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!j31g2000yqa.googlegroups.com!not-for-mail From: jonathan Newsgroups: comp.lang.ada Subject: Re: Is there an Ada compiler whose Ada.Numerics.Generic_Elementary_Functions.Log(Base=>10, X=>variable) is efficient? Date: Mon, 15 Feb 2010 06:54:56 -0800 (PST) Organization: http://groups.google.com Message-ID: <7b3d1a4c-e61f-41c0-a35b-a9d13c6f4f67@j31g2000yqa.googlegroups.com> References: NNTP-Posting-Host: 143.117.23.62 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1266245696 638 127.0.0.1 (15 Feb 2010 14:54:56 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 15 Feb 2010 14:54:56 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: j31g2000yqa.googlegroups.com; posting-host=143.117.23.62; posting-account=Jzt5lQoAAAB4PhTgRLOPGuTLd_K1LY-C User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.16) Gecko/2009121609 Iceweasel/3.0.6 (Debian-3.0.6-3),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:9236 Date: 2010-02-15T06:54:56-08:00 List-Id: On Feb 15, 10:58=A0am, Colin Paul Gloster wrote: > Hello, > > I have been improving a program by suppressing C++ in it. After > speeding it up a lot by making changes, I have found one considerable > part which calls a library routine, which is unfortunately very slow > as provided as standard with a number of Ada compilers but which is > very fast with implementations of other languages.... Here is my own bench ... easier to play with: with ada.numerics.generic_elementary_functions; with text_io; use text_io; procedure log_bench is type Real is digits 15; package Math is new ada.numerics.generic_elementary_functions (Real); use Math; x, y : Real :=3D 0.1; -- might (or might not!) be faster to use: -- log_base_10 (x) =3D log_base_10_of_e * log_base_e (x) Log_base_10_of_e : constant :=3D 0.434_294_481_903_251_827_651_129; begin for i in 1 .. 1_000_000 loop x :=3D x + Log_base_10_of_e * Log (y); y :=3D y + 0.0000000000001; end loop; put (Real'Image(x)); end log_bench; gnatmake gnatnp -O2 -march=3Dnative log_bench.adb