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,9c3a1871d2161925 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-03 15:24:39 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.onemain.com!feed1.onemain.com!uunet!dca.uu.net!ash.uu.net!xyzzy!nntp From: Jeffrey Carter Subject: Re: C/Ada performance comparison X-Nntp-Posting-Host: e246420.msc.az.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: <3B424298.9A7849CF@boeing.com> Sender: nntp@news.boeing.com (Boeing NNTP News Access) Content-Transfer-Encoding: 7bit Organization: The Boeing Company X-Accept-Language: en References: <3B3C8E6A.39361C75@labe.felk.cvut.cz> Mime-Version: 1.0 Date: Tue, 3 Jul 2001 22:09:28 GMT X-Mailer: Mozilla 4.5 [en]C-CCK-MCD Boeing Kit (WinNT; U) Xref: archiver1.google.com comp.lang.ada:9402 Date: 2001-07-03T22:09:28+00:00 List-Id: Tomas Hlavaty wrote: > > I have a question about the CPU load of Ada programs. I have a program > reimplemented from C to Ada (Linux, GNAT) and now I've found the Ada > program consumes about 7 times more CPU time than the C one. Is it > common case or does it indicate an error in my Ada implementation (I'm > quite new in Ada)? Is there any comparison/statistics on performance of > C/Ada programs? In general, equivalent Ada and C programs have equivalent run times. Robert Dewar claims to have a collection of equivalent programs that produce identical object code when compiled using gcc. A factor of 7 implies that the programs are not equivalent. I suggest you unknowingly used an expensive feature of Ada. Different levels of optimization might also account for the difference. Although one of the factors for programs to be equivalent is run-time checks, I would not expect them to give a factor of 7 difference. Suppressing Ada run-time checks usually does not reduce run times by more than about 10%. -- Jeffrey Carter