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=0.6 required=5.0 tests=BAYES_00,TO_NO_BRKTS_FROM_MSSP autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1d575f572a099528 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-03 06:39:17 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed.berkeley.edu!news-hog.berkeley.edu!ucberkeley!nntp-relay.ihug.net!ihug.co.nz!out.nntp.be!propagator-SanJose!in.nntp.be!newsranger.com!www.newsranger.com!not-for-mail Newsgroups: comp.lang.ada From: Ted Dennison References: <3c08314d$0$158$9b622d9e@news.freenet.de> Subject: Re: What is faster Ada or C? Message-ID: X-Abuse-Info: When contacting newsranger.com regarding abuse please X-Abuse-Info: forward the entire news article including headers or X-Abuse-Info: else we will not be able to process your request X-Complaints-To: abuse@newsranger.com NNTP-Posting-Date: Mon, 03 Dec 2001 09:39:02 EST Organization: http://www.newsranger.com Date: Mon, 03 Dec 2001 14:39:02 GMT Xref: archiver1.google.com comp.lang.ada:17334 Date: 2001-12-03T14:39:02+00:00 List-Id: In article <3c08314d$0$158$9b622d9e@news.freenet.de>, Heiko Hamann says... >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? This gets asked here a lot. In truth, its a bad question. There really is no such thing as a fast or slow language. A language can't have a speed, its an abstract concept. If you were to ask which language's compilers would, in theory, be able to produce faster executables, the answer would be Ada. Ada's a lot more strict than C, which means its optimizer has a lot more information to work with. However, this isn't the question you really care about the answer to. What you need to know is which of your available compilers will you be able to create faster executables with. The main variables here aren't language, but rather the effort the various compiler writers put into optimization, and the quality of *your* code. For example, the Aonix Ada compiler has *no* user-visible optimization options (last I checked anyway). Its intended audience appears to be Windows GUI programmers, and speed just isn't as important to them as good Windows support. I'm sure there are several Windows-based C compilers with this same philosophy. Green Hills, on the other hand, produces Ada compilers with oodles of optimization options. The same numeric computation code most likely going to run much faster when compiled and properly optimized with a GreenHills x86 compiler than with one of those others. Gnat on the other hand, uses the same code generation back end as Gcc. Thus a fair comparison between C and Ada code when both are compiled with GCC is liable to show you no difference at all. Also, large amounts of compiler optimization aren't liable to save you if you perform slow operations with one language and faster ones with another. Your algorithms have to be comparable, or all bets are off. --- T.E.D. homepage - http://www.telepath.com/dennison/Ted/TED.html No trees were killed in the sending of this message. However a large number of electrons were terribly inconvenienced.