TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
"Richard G. Hash" <[log in to unmask]>
Reply To:
Richard G. Hash
Wed, 8 Jan 1997 08:59:49 -0600
text/plain (54 lines)
According to Dirk Craeynest:
  [wrt comp.compilers article]

Arch Robison is describing his experience with Ada at Shell in the late
80's/early 90's - and I'm quite familiar with his experience, since I was
there (and still am!).  If any of you SVUGs are still around, I'm sure you
can understand his thinking the optimization of that time was bad - it was.

I've already replied to comp.compilers:
> ---------------  Forwarding  -----------------
> >[Do Ada compilers really generate better code than C compilers for similar
> >source code? -John]
> I have one anecdotal data point that says no.  While working for my
> former employer, I was asked to investigate why a new piece of
> software written in Ada was so much slower than its old counterpart in
> Fortran.  The presumed reason was "new feature and flexibility bloat".
> But profiling indicated the problem was really with some basic
> old-fashioned numerical inner loops.  Not being strong on Fortran, I
> rewrote the loops in C for comparison.  The C was at least 2x faster.
> Inspection of the assembly code indicated that the Ada compiler was
> lacking fundamental optimizations present in the C compiler.
> This is of course a single data point, probably obsolete.

Indeed. I worked in that Ada group at his former employer (and still do),
and can offer another data point that says "(modern) Ada compilers nearly
*always* generate as-good or better code for *similar* source code"

The Ada in question was being compiled with a 1988-vintage compiler
(Verdix) which wasn't all that great (if you claim it was awful, I won't
argue).  We never compiled with any optimization at all (-O0), since it
didn't work, and stuff like unconstrained arrays would kill you every time
performance-wise.  Verdix was struggling to convince people their compiler
worked at all, and didn't seem to put much effort into optimizations as the
time.  But other vendors at that time (like Tartan), were well known for
very good optimizations.

It wasn't so much the Ada compiler was "lacking fundamental optimizations",
they were there (in intent), but generated such buggy code that nobody
would use them.  Any reasonably modern Ada compiler has pretty darn good
optimizations.  If you examine the GNU Ada compiler you will find that it
generates identical output compared to the GNU C compiler (for similar
code).  Since Arch's time here, our Ada benchmark code runs roughly 2.4
times faster than it did (on same machine-type), and the only thing that's
changed is the compiler version.  I like not spending my time on
optimizations like that!

What can be tricky, of course, is what constitutes "similar" code.
Richard Hash              [log in to unmask]           (713) 245-7311
Subsurface Information Technology Services, Shell Services Company