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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7b73eb137e4ed638 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-21 14:31:01 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: gab@rational.com (Greg Bek) Newsgroups: comp.lang.ada Subject: Re: Ada Compilers Date: 21 May 2002 14:31:01 -0700 Organization: http://groups.google.com/ Message-ID: References: <3CE2AF22.2060208@gmx.spam.egg.sausage.and.spam.net> <878z6kq4rr.fsf@deneb.enyo.de> <3CE58053.2020809@gmx.spam.egg.sausage.and.spam.net> NNTP-Posting-Host: 130.213.23.210 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1022016661 31553 127.0.0.1 (21 May 2002 21:31:01 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 21 May 2002 21:31:01 GMT Xref: archiver1.google.com comp.lang.ada:24485 Date: 2002-05-21T21:31:01+00:00 List-Id: As a compiler vendor I'd just like to echo MDC's comments. Don't just use standard benchmarks, use your application or portions of it for testing performance. Benchmarks like the PIWG's are not sufficiently sophisticated to properly perform timing of null loops etc. Ada compilers have many advantages over languages like C/C++ in that the compiler has greater visibility into the rest of a user program. An Ada compiler can automatically inline code across multiple levels of subprogram call, C/C++ have difficulty doing this as any called subprogram is usually compiled into a different object module. This means that C/C++ must perform a call/return where the Ada code may have the call/return (and associated prolog/epilog, stack check) eliminated. Our compiler (Rational Apex), performs this kind of inlining as well as loop unrolling etc. Another very useful technique is "value propagation", this is where the compiler tracks the range of values taken by an object. Knowing the possible range of values means that the compiler can eliminate constraint checks that are not needed. This can have some very disconcerting side affects for the unwary. If the compiler determines that a section of code has no side affects (ie: no exceptions can be raised), and that the results of that section of code are not used, then it eliminates all of the code. The PIWG henessey benchmark is an example of code that suffers because of this. The large matrix multiplication contained within the benchmark is eliminated as the matracies are populated with small-ish values, the compiler concludes that the range of the resulting sum of products will never overflow. It then discovers that the resulting matrix is never used, so it throws out the entire matrix multiplication. The surrounding timing loop is now timing a null operation. Modern compilers are very good at producing optimized code under most circumstances. However there are some subtle issues with Ada that can prevent getting the best code possible. The best example of this is using controlled objects within your program. Controlled types require the compiler to generate invisible code that makes sure any objects are properly finalized when a scope is exited. When compiling a routine that uses a class wide type the compiler may not know whether controlled types are used to extend the base type, so it must be pessimistic and generate finalization code that may never be called. If you don't have controlled objects and your compiler has a mechanism for optimizing accordingly, then use that mechanism (switch, library directive, configuration pragma). As always your milage will vary. Greg Bek ------------------------------------------- Greg Bek mailto:gab@rational.com Product Manager, Rational Apex Family Rational Software -------------------------------------------