comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: small example, using complex variables in Ada
Date: Thu, 10 Jun 2010 10:37:47 -0700 (PDT)
Date: 2010-06-10T10:37:47-07:00	[thread overview]
Message-ID: <d4204665-eb3c-471c-b771-3090adba0189@j12g2000pri.googlegroups.com> (raw)
In-Reply-To: alpine.LNX.2.00.1006101614090.3765@Bluewhite64.example.net

On Jun 10, 9:21 am, Colin Paul Gloster <Colin_Paul_Glos...@ACM.org>
wrote:
> On Thu, 10 Jun 2010, Ludovic Brenta sent:
>
> |---------------------------------------------------------------------|
> |"On Jun 10, 5:48 pm, Colin Paul Gloster <Colin_Paul_Glos...@ACM.org> |
> |wrote:                                                               |
> |> On Wed, 9 Jun 2010, Ludovic Brenta sent:                           |
> |>                                                                    |
> |> |     Two_Pi_Over_N : constant := 2 * Pi / N;|                     |
> |>                                                                    |
> |> That is a good suggestion.                                         |
> |>                                                                    |
> |> |"     FOR k in X'range LOOP"                |                     |
> |>                                                                    |
> |> No.                                                                |
> |                                                                     |
> |Why?                                                                 |
> |                                                                     |
> |> |"         FOR m in data'range LOOP          |                     |
> |>                                                                    |
> |> No. Loop down to zero.                                             |
> |                                                                     |
> |Why?"                                                                |
> |---------------------------------------------------------------------|
>
> Though there should be no difference, in reality compilers produce
> less slow machine code when looping down to zero instead of up from
> zero.

I don't think you can state that categorically.  We don't even know
what processor the OP was generating code for.  Not all of them have
"decrement and branch if nonnegative" instructions.  In any event, I
think the only way to really know which one is faster is to try it, or
to examine the generated code---and the latter probably isn't good
enough these days, with all the pipelining that goes on.

                      -- Adam

  reply	other threads:[~2010-06-10 17:37 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-09 10:49 small example, using complex variables in Ada Nasser M. Abbasi
2010-06-09 11:26 ` Ludovic Brenta
2010-06-09 23:50   ` Jerry
2010-06-10  1:03     ` Jeffrey R. Carter
2010-06-10 15:48   ` Colin Paul Gloster
2010-06-10 14:54     ` Ludovic Brenta
2010-06-10 16:21       ` Colin Paul Gloster
2010-06-10 17:37         ` Adam Beneschan [this message]
2010-06-10 17:57         ` Jeffrey R. Carter
2010-06-10 22:32           ` Randy Brukardt
2010-06-11 12:42             ` Colin Paul Gloster
2010-06-11 18:59               ` Randy Brukardt
2010-06-14 19:19                 ` Colin Paul Gloster
2010-06-14 19:48                   ` Nasser M. Abbasi
2010-06-17  7:44     ` Gautier write-only
2010-06-17 10:33       ` Colin Paul Gloster
2010-06-17 14:39       ` Yannick Duchêne (Hibou57)
2010-06-17 16:36         ` Colin Paul Gloster
2010-06-09 12:43 ` Niklas Holsti
2010-06-10  7:23 ` Stephen Leake
2010-06-10  9:12   ` J-P. Rosen
2010-06-10 11:03     ` Yannick Duchêne (Hibou57)
2010-06-10 13:27       ` J-P. Rosen
2010-06-10 21:15         ` Yannick Duchêne (Hibou57)
2010-06-11  7:22           ` Dmitry A. Kazakov
2010-06-11  8:48           ` J-P. Rosen
2010-06-11 12:00             ` Brian Drummond
2010-06-10  9:34   ` Nasser M. Abbasi
2010-06-10 20:12     ` Simon Wright
2010-06-14  9:33 ` Vincent LAFAGE
2010-06-14 12:29   ` Nasser M. Abbasi
2010-06-14 13:00     ` Vincent LAFAGE
replies disabled

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