comp.lang.ada
 help / color / mirror / Atom feed
From: Howard W LUDWIG <howard.w.ludwig@lmco.com>
Subject: Re: Ada vs. C, compiler optimization
Date: 1998/12/17
Date: 1998-12-17T00:00:00+00:00	[thread overview]
Message-ID: <3679BBFC.7C258A5@lmco.com> (raw)
In-Reply-To: 75bhpp$asq@bgtnsc03.worldnet.att.net

Craig Franck wrote:

> mgk25@cl.cam.ac.uk (Markus Kuhn) wrote:
> >> I am in search of a paper which describes the advantages of
> >> Ada over C concerning optimization.
> >
> >From the Lovelace bibliography:
> >
> >  Syiek, David. 1995. "C vs. Ada: Arguing Performance Religion",
> >  ACM Ada Letters, Nov/Dec 1995, pp. 67-69.
> >  This paper demonstrates that Ada and C programs run at about
> >  the same speed using compilers of approximately equal maturity,
> >  with Ada having a slight performance edge because the Ada
> >  compiler has more information to work with.
>
> Does he mean other than the source code?
>

No!  This is the advantage several features which Ada provides and C
doesn't.

Control of name aliasing (via access types, a.k.a. pointers) is probably
the most important, in that in order to be referenceable by pointers as
well as its own identifier in Ada, an object must be declared as
aliased.  If it is not, the compiler is free to make safe assumptions
about its value not changing since the last assignment to that variable
and not reload its value.  In C, any object can be pointed to, and it is
much harder for a compiler to determine if an object has been modified
via a pointer since the last assignment to that object; the choices are
to generate slower code reloading the contents of that object from
memory into a register, or hope for the best (and sometimes be
drastically wrong) that the contents still in the register from the last
load are good.

Strong typing and range constraints built into Ada can also be analyzed
by the compiler and generate more efficient code than manually coded
constraint checking can.

> --
> Craig
> clfranck@worldnet.att.net
> Manchester, NH
> A man's most valuable trait is a judicious sense of
> what not to believe.  -- Euripides

Howard W. LUDWIG





      reply	other threads:[~1998-12-17  0:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-11-09  0:00 Ada vs. C, compiler optimization Peter Hermann
1998-12-16  0:00 ` Prof. Dr. Theodor Tempelmeier
1998-12-16  0:00 ` Prof. Dr. Theodor Tempelmeier
1998-12-16  0:00 ` Prof. Dr. Theodor Tempelmeier
1998-12-16  0:00 ` Prof. Dr. Theodor Tempelmeier
1998-12-17  0:00 ` Markus Kuhn
1998-12-17  0:00   ` Steve O'Neill
1998-12-17  0:00   ` Craig Franck
1998-12-17  0:00     ` Howard W LUDWIG [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox