|Ada vs. C performance, was Possible to write compiler to Java VM? email@example.com (Arch Robison) (1997-01-07)|
|Re: Ada vs. C performance, was Possible to write compiler to Dave_Koogler_at_CCISDAPPS1@ppc-191.putnaminv.com (1997-01-09)|
|Re: Ada vs. C performance, was Possible to write compiler to firstname.lastname@example.org (Craig Burley) (1997-01-12)|
|Re: Ada vs. C performance, was Possible to write compiler to email@example.com (Toon Moene) (1997-01-14)|
|Re: Ada vs. C performance, was Possible to write compiler to firstname.lastname@example.org (Christopher Glaeser) (1997-01-17)|
|Date:||9 Jan 1997 22:03:47 -0500|
|Keywords:||Ada, C, performance|
>[Do Ada compilers really generate better code than C compilers for
> similar source code? -John]
This is very easy to prove: the Gnat Ada compiler is built upon the
same code generator as the Gnu C compiler. When an algorithm is
expressed in a similar fashion in the two languages, the resulting
code is almost identical.
However, to really use Ada well, you do not write algorithms in the
same fashion as in C. For instance, I tend to use array slice notation
instead of 'for' loops or 'memcpy' calls. As it turns out, in the Gnat
compiler the slice translates into the equivalent 'for' loop or even
an inline memory copy. The slice notation is a higher level
abstraction and it's meaning is certainly easier to comprehend than a
'for' loop, especially when you are already several levels deep in
algorithm. I prefer to say things directly rather then imply things
The Gnat implementation allows you to readily compare the
effectiveness of the two languages without the 'noise' introduced by
differences in the maturity and capability of the code generator. In
my experiments, I can't say I have seen too many examples where C
produces a superior algorithm but in many cases my Ada algorithms have
been more comprehensible and more efficient than their C equivalents.
The issue really gets down to the quality of the programmer and how
well they understand a language's strengths and failures.
Boolean Solutions, Ltd.
Return to the
Search the comp.compilers archives again.