comp.lang.ada
 help / color / mirror / Atom feed
From: sjw <simon.j.wright@mac.com>
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 12:00:52 -0800 (PST)
Date: 2010-02-15T12:00:52-08:00	[thread overview]
Message-ID: <993d3a57-ba45-4b5a-b61e-e6c2c8ad4283@d37g2000yqa.googlegroups.com> (raw)
In-Reply-To: C79F4257.1365BE%yaldnif.w@blueyonder.co.uk

On Feb 15, 6:26 pm, "(see below)" <yaldni...@blueyonder.co.uk> wrote:
> On 15/02/2010 10:58, in article
> alpine.LNX.2.00.1002151055530.17...@Bluewhite64.example.net, "Colin Paul
>
> Gloster" <Colin_Paul_Glos...@ACM.org> wrote:
> > Of the two programs shown, the fastest C++ implementation on one test
> > platform took less than one millisecond and the fastest Ada
> > implementation took one minute and 31 seconds and 874 milliseconds on
> > the same platform. Both g++ and gnatmake were from the same
> > installation of GCC 4.1.2 20080704 (Red Hat 4.1.2-44).
>
> Is that 1 millisecond for 1e6 calls? This implies 1ns per call in C++.
> I find it incredible that a log function could be so fast.
> I think the loop body must be evaluated at compile-time in C++.

I think it's a mixture of your point & Jonathan's; the loop body, with
the 500 calls to log10(), is executed once, then the compiler smartly
realizes that each iteration produces the same increment.



  parent reply	other threads:[~2010-02-15 20:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-15 10:58 Is there an Ada compiler whose Ada.Numerics.Generic_Elementary_Functions.Log(Base=>10, X=>variable) is efficient? Colin Paul Gloster
2010-02-15 13:02 ` John B. Matthews
2010-02-15 14:17   ` Colin Paul Gloster
2010-02-15 17:19     ` John B. Matthews
2010-02-15 14:54 ` jonathan
2010-02-15 15:04   ` jonathan
2010-02-15 19:50     ` sjw
2010-02-16 16:50       ` Colin Paul Gloster
2010-02-15 18:26 ` (see below)
2010-02-15 18:51   ` jonathan
2010-02-15 20:00   ` sjw [this message]
2010-02-15 21:17     ` jonathan
2010-02-16  0:09       ` jonathan
2010-02-16 17:33   ` Colin Paul Gloster
2010-02-24 10:07     ` Colin Paul Gloster
2010-02-15 23:04 ` Jeffrey R. Carter
2010-02-16 14:54   ` Colin Paul Gloster
2010-02-16 15:24     ` Colin Paul Gloster
2010-02-16 19:01     ` Jeffrey R. Carter
2010-02-17 10:25       ` Colin Paul Gloster
2010-02-15 23:20 ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox