From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1014db,44b1fe5008113252 X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,80c7ab786b3615ef X-Google-Attributes: gid103376,public From: Howard W LUDWIG Subject: Re: Ada vs. C, compiler optimization Date: 1998/12/17 Message-ID: <3679BBFC.7C258A5@lmco.com>#1/1 X-Deja-AN: 423467058 Content-Transfer-Encoding: 7bit References: <726s4n$g9h$1@infosun2.rus.uni-stuttgart.de> <75avbv$ehs$1@pegasus.csx.cam.ac.uk> <75bhpp$asq@bgtnsc03.worldnet.att.net> Content-Type: text/plain; charset=us-ascii Organization: Lockheed Martin -- Information Systems Center Mime-Version: 1.0 Newsgroups: comp.lang.ada,comp.lang.c Date: 1998-12-17T00:00:00+00:00 List-Id: 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