comp.lang.ada
 help / color / mirror / Atom feed
From: "Elias Salomão Helou Neto" <eshneto@gmail.com>
Subject: Re: Efficiency of code generated by Ada compilers
Date: Mon, 16 Aug 2010 06:45:05 -0700 (PDT)
Date: 2010-08-16T06:45:05-07:00	[thread overview]
Message-ID: <6ba116c2-f922-469c-88ff-29ae3d4720de@j8g2000yqd.googlegroups.com> (raw)
In-Reply-To: 1jn7hdz.1612v6172y0thN%csampson@inetworld.net

On Aug 14, 1:13 pm, csamp...@inetworld.net (Charles H. Sampson) wrote:
> Elias Salomão Helou Neto <eshn...@gmail.com> wrote:
>
> > ...
>
> > Well, we are definitely drifting away from the original question. So
> > much that I am considering to give up reading answers from this
> > post...
>
> > Anyway, someone prematurely implied that I may be doing premature
> > optimization. The fact is that I do know, from profiling, how
> > important is _not_ to range check in my specific application, so I
> > will try to give you a "bottom line" of what have been said that
> > really matters to me.
>
> > ...
>
>      I think I'm the guy who implied that you're doing premature
> optimization, or at least the guy who you think implied that.
>
>      You appear to have a deep knowledge of your application.  I
> certainly don't.  Therefore I have to defer to your judgement on the
> question.  But I probably did raise the question that you _might be_
> prematurely worrying about optimiziing.  What I remember saying is that
> almost every time  _I_ make a guess about optimization, I'm wrong.

Dimitry pointed out above that the compiler could suppress the checks
by itself, which would mean my optimization was unnecessary anyway. I
think it was a good point indeed, but I kind of doubt that a compiler
could be smart enough for doing that in my case anyway. Maybe I am
just not smart enough to think of a good optimizing strategy for
compilers :)

And yes, I know how many times guesses about optimization are just
plain and simply wrong.

>      A number of people have given you information about optimization of
> a number of Ada compilers.  I'll give you an example of the last one I
> worked with.  This compiler uses a not uncommon approach to code
> generation.  It initially generates pretty mediocre code, in particular
> code that contains a lot of unnecessary range checks and even
> unnecessary register loads.  Then, if the user wants, it passes that
> code through a pretty good optimizer.  You might say that the compiler
> has two modes, development and production.
>
>      My last project was a real-time application.  We hit all of our
> deadlines, which is all that counts in the real-time world.  (We
> achieved this in the crudest way: We beat it about the head and
> shoulders with a very fast CPU and gobs of memory.)  Nonetheless, twice
> during my time on the project, I compiled the whole application using
> the optimizer (but not with range checks, or any checks, explicitly
> suppressed).  The generated code improved dramatically.  Checks that the
> optimizer could verify weren't needed disappeared.  Code motion did some
> pretty things.  And so on.  However, when I ran this much improved
> version, I couldn't see any difference between it and the crude version,
> including any increase in the amount of time the application was in its
> idle state.  In short, whatever improvement there was in execution,
> wasn't worth the increase in compilation time.
>
>      That's a pretty standard story, illustrating that you usally need
> to analyze before optimizing.  However, as people love to say, YMMV.
> (That's twitter-speak for "This might not apply in your case.")

In my case, things were somewhat different. For example, manually
telling GCC to inline some functions reduced running times in about
15%. Even if I turned GCC's optimizer fully on, it was not able to
automatically inline those functions. That should have been a simple
matter to the optimizer, since I did not use any pointer to that
function or something similar. I guess we are running into different
results here because I am writing numerical software that runs very
tight loops within which I have to address matrices elements in a
_very_ efficient manner.

>
>                         Charlie
> --
> All the world's a stage, and most
> of us are desperately unrehearsed.  Sean O'Casey

Thank you,
Elias Salomão Helou Neto



  reply	other threads:[~2010-08-16 13:45 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-06 20:21 Efficiency of code generated by Ada compilers Elias Salomão Helou Neto
2010-08-06 20:24 ` (see below)
2010-08-06 23:14 ` Shark8
2010-08-07  7:53 ` Dmitry A. Kazakov
2010-08-10 13:52   ` Elias Salomão Helou Neto
2010-08-10 14:24     ` Shark8
2010-08-10 14:28     ` Shark8
2010-08-10 15:01     ` Robert A Duff
2010-08-10 15:14       ` Yannick Duchêne (Hibou57)
2010-08-10 18:32         ` Robert A Duff
2010-08-10 15:10     ` Georg Bauhaus
2010-08-10 15:32     ` Dmitry A. Kazakov
2010-08-10 22:26     ` Randy Brukardt
2010-08-20  7:22       ` Yannick Duchêne (Hibou57)
2010-08-08 14:03 ` Gene
2010-08-08 15:49   ` Robert A Duff
2010-08-08 17:13     ` Charles H. Sampson
2010-08-08 18:11       ` Dmitry A. Kazakov
2010-08-08 20:51       ` Robert A Duff
2010-08-08 22:10         ` (see below)
2010-08-08 22:22           ` Robert A Duff
2010-08-09  4:46         ` Yannick Duchêne (Hibou57)
2010-08-09  5:52         ` J-P. Rosen
2010-08-09 13:28           ` Robert A Duff
2010-08-09 18:42             ` Jeffrey Carter
2010-08-09 19:05               ` Robert A Duff
2010-08-10 10:00                 ` Jacob Sparre Andersen
2010-08-10 12:39                   ` Robert A Duff
2010-08-09 19:33             ` Yannick Duchêne (Hibou57)
2010-08-09 21:42               ` Robert A Duff
2010-08-10 12:26         ` Phil Clayton
2010-08-10 12:57           ` Yannick Duchêne (Hibou57)
2010-08-10 14:03             ` Elias Salomão Helou Neto
2010-08-10 14:27               ` Yannick Duchêne (Hibou57)
2010-08-10 22:50                 ` anon
2010-08-10 23:28                   ` Yannick Duchêne (Hibou57)
2010-08-10 23:38                     ` Yannick Duchêne (Hibou57)
2010-08-11  7:06                       ` Niklas Holsti
2010-08-11 11:58                         ` anon
2010-08-11 12:37                           ` Georg Bauhaus
2010-08-11 13:13                         ` Robert A Duff
2010-08-11 23:49                           ` Randy Brukardt
2010-08-10 14:31               ` Shark8
2010-08-11  7:14               ` Charles H. Sampson
2010-08-11  6:42         ` Charles H. Sampson
2010-08-08 22:35     ` tmoran
2010-08-09 13:53       ` Robert A Duff
2010-08-09 17:59         ` tmoran
2010-08-09 19:36           ` Yannick Duchêne (Hibou57)
2010-08-09 21:38             ` Robert A Duff
2010-08-11  7:42       ` Charles H. Sampson
2010-08-11 13:38         ` Robert A Duff
2010-08-12  7:48           ` Charles H. Sampson
2010-08-12  8:08             ` Ludovic Brenta
2010-08-12 17:10               ` Charles H. Sampson
2010-08-12 18:06                 ` Jeffrey Carter
2010-08-11 18:49         ` Simon Wright
2010-08-12  7:54           ` Charles H. Sampson
2010-08-12  8:36             ` Dmitry A. Kazakov
2010-08-12 11:04             ` Brian Drummond
2010-08-12 19:23             ` Simon Wright
2010-08-12 20:21               ` (see below)
2010-08-13 15:08                 ` Elias Salomão Helou Neto
2010-08-13 15:10                   ` Elias Salomão Helou Neto
2010-08-13 18:01                     ` Georg Bauhaus
2010-08-13 19:52                       ` Robert A Duff
2010-08-14  9:44                         ` Georg Bauhaus
2010-08-13 20:22                     ` Robert A Duff
2010-08-14  1:34                       ` Randy Brukardt
2010-08-14  7:18                         ` anon
2010-08-13 21:57                     ` Jeffrey Carter
2010-08-13 22:37                       ` Yannick Duchêne (Hibou57)
2010-08-13 22:43                         ` Yannick Duchêne (Hibou57)
2010-08-13 23:29                         ` tmoran
2010-08-14  0:02                           ` Yannick Duchêne (Hibou57)
2010-08-14  0:16                             ` (see below)
2010-08-14 10:47                             ` Brian Drummond
2010-08-14 13:58                               ` Yannick Duchêne (Hibou57)
2010-08-15  0:23                                 ` Brian Drummond
2010-08-14 14:51                               ` (see below)
2010-08-15  0:58                                 ` Brian Drummond
2010-08-15  1:58                                   ` (see below)
2010-08-15 10:31                                     ` Brian Drummond
2010-08-13 15:37                   ` Dmitry A. Kazakov
2010-08-16 13:29                     ` Elias Salomão Helou Neto
2010-08-16 14:09                       ` Dmitry A. Kazakov
2010-08-18 14:00                         ` Elias Salomão Helou Neto
2010-08-18 16:38                           ` Dmitry A. Kazakov
2010-08-19 18:52                             ` Elias Salomão Helou Neto
2010-08-19 19:48                               ` Dmitry A. Kazakov
2010-08-13 16:58                   ` (see below)
2010-08-14 16:13                   ` Charles H. Sampson
2010-08-16 13:45                     ` Elias Salomão Helou Neto [this message]
2010-08-15 12:32 ` Florian Weimer
replies disabled

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