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: 103376,c615e41a65104004 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Performance Ada and C Date: 1998/07/03 Message-ID: #1/1 X-Deja-AN: 368483379 References: <35921271.E51E36DF@aonix.fr> <3598358A.73FF35CC@pipeline.com> <6nh762$66i@netline.jpl.nasa.gov> <359CB19D.EDAD6D1F@cl.cam.ac.uk> X-Complaints-To: usenet@news.nyu.edu X-Trace: news.nyu.edu 899493572 30957 (None) 128.122.140.58 Organization: New York University Newsgroups: comp.lang.ada Date: 1998-07-03T00:00:00+00:00 List-Id: Markus says <, and while the best available C implementation did 27 Mbit/s, I wasn't able to get with Ada more than 20 Mbit/s on the same processor (Pentium II, 300 MHz) using the same compiler (gnat-3.10p). >> It is always possible to duplicate the object code of any C code writing in 100% Ada using GNAT. Of course you may have to write at a lower semantic level than you would wish. But if you didn't close the gap, it just means you didn't use the right approach. Most probably you were using some Ada specific feature that you thought was equivalent to the C code when it was not, that is the most common reason for this kind of failure. Of course it is also possible to write inefficient C without being very aware of things. For exanmle, the use of strlen can be horrible compared to the direct reading of the bounds of an array in Ada. So this is not something that is asymmetrical. Whether a C program or an Ada program for the same task is faster or slower depends primarily on the programming style used by the programmer, and only secondarily on the compiler. I am always surprised how often Ada programmers have no idea of the consequences of what they write. By the way the -gnatdg switch in GNAT is a useful tool in this regard.