> >[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!