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 X-Google-Thread: 103376,1d575f572a099528 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-01 01:26:15 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!128.39.3.168!uninett.no!nntp.uib.no!not-for-mail From: Gisle =?iso-8859-1?Q?S=E6lensminde?= Newsgroups: comp.lang.ada Subject: Re: What is faster Ada or C? Date: 1 Dec 2001 09:26:14 GMT Organization: Institutt for Informatikk, UiB Message-ID: References: <3c08314d$0$158$9b622d9e@news.freenet.de> NNTP-Posting-Host: apal.ii.uib.no Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: toralf.uib.no 1007198774 49473 129.177.16.7 (1 Dec 2001 09:26:14 GMT) X-Complaints-To: abuse@uib.no NNTP-Posting-Date: 1 Dec 2001 09:26:14 GMT User-Agent: slrn/0.9.7.2 (SunOS) Xref: archiver1.google.com comp.lang.ada:17271 Date: 2001-12-01T09:26:14+00:00 List-Id: In article <3c08314d$0$158$9b622d9e@news.freenet.de>, Heiko Hamann wrote: > Hi! > > I have a program written in Ada that is very processor intensiv. It does bit > and integer operations. What would you guess is the faster languages for > this task? Ada or C - or another language (excpet Assembler)? Can that be > said in common? What is about some benchmarks concerning this case? > It depends on the compiler. Both Ada and C makes it possible to write efficient code, given a good compiler. If Borland C++ is used to compile the C code, and GNAT is used to compile the Ada code, The Ada program will probably be faster, because GNAT has a better optimizer. If the Ada compiler is Aonix and the compiler used to compile the C code is Microsoft C++, the C program will usually win. This is in general, and will not always be true. The numbers comes from my experirience from optimization using these compilers, including things like dumping the assembly output to see which code the compiler emits. My point is that compilers is more important than the language, especially when you compare two system programing languages like C and Ada. I have used C++ compilers as example, which arguable can be said to be incorrect, given that C (no longer?) is a subset of C++, but I don't think it will make my point invalid in this case. Another important point is that before optimization makes sense, the program have to be correct and stable. That is easier to archive in Ada than C, because all the unsafe features of C. -- Gisle S�lensminde ( gisle@ii.uib.no ) With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. (from RFC 1925)