Related articles |
---|
Ada vs. C performance, was Possible to write compiler to Java VM? robison@kai.com (Arch Robison) (1997-01-07) |
Re: Ada vs. C performance, was Possible to write compiler to Java VM? Laurent.Guerby@enst-bretagne.fr (Laurent Guerby) (1997-01-09) |
Ada vs. C performance, was Possible to write compiler to Java VM? rgh@shellus.com (1997-01-09) |
Re: Ada vs. C performance, was Possible to write compiler to Java VM? ronald.ten-hove@itron.com (Ron Ten-Hove) (1997-01-12) |
Re: Ada vs. C performance, was Possible to write compiler to Java VM? toon@moene.indiv.nluug.nl (Toon Moene) (1997-01-12) |
Re: Ada vs. C performance, was Possible to write compiler to Java VM? cdg@nullstone.com (Christopher Glaeser) (1997-01-14) |
From: | rgh@shellus.com (Richard G. Hash) |
Newsgroups: | comp.compilers |
Date: | 9 Jan 1997 22:21:22 -0500 |
Organization: | Compilers Central |
References: | 97-01-045 |
Keywords: | Ada, C, performance |
> >[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 is tricky, of course, is what constitutes "similar" code.
--
Richard Hash rgh@shellus.com (713) 245-7311
Subsurface Information Technology Services, Shell Services Company
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.