Re: Ada vs. C performance, was Possible to write compiler to

Dave_Koogler_at_CCISDAPPS1@ppc-191.putnaminv.com
9 Jan 1997 22:03:47 -0500

          From comp.compilers

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 Dave_Koogler_at_CCISDAPPS1@ppc-191.putnaminv.com (1997-01-09)
Re: Ada vs. C performance, was Possible to write compiler to burley@gnu.ai.mit.edu (Craig Burley) (1997-01-12)
Re: Ada vs. C performance, was Possible to write compiler to toon@moene.indiv.nluug.nl (Toon Moene) (1997-01-14)
Re: Ada vs. C performance, was Possible to write compiler to cdg@nullstone.com (Christopher Glaeser) (1997-01-17)
| List of all articles for this month |
From: Dave_Koogler_at_CCISDAPPS1@ppc-191.putnaminv.com
Newsgroups: comp.compilers
Date: 9 Jan 1997 22:03:47 -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]


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
indirectly.


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.


Dave Koogler
Boolean Solutions, Ltd.
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.