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,ec4f8ae8cbf8519f X-Google-Attributes: gid103376,public From: ok@goanna.cs.rmit.EDU.AU (Richard A. O'Keefe) Subject: Re: Ada vs. C: performance, size Date: 1997/01/13 Message-ID: <5bcdjo$s82$1@goanna.cs.rmit.EDU.AU>#1/1 X-Deja-AN: 209637248 references: <9701092022.AA15007@most> organization: Comp Sci, RMIT, Melbourne, Australia nntp-posting-user: ok newsgroups: comp.lang.ada Date: 1997-01-13T00:00:00+00:00 List-Id: >Date: Thu, 9 Jan 1997 10:20:07 -0800 >From: "Chris Sparks (Mr. Ada)" >I ... was wondering if code size would be roughly the >same on equivalent pieces of "C" and "Ada" code. One condition of >course is that no optimizations is used on both, and Ada would be >allowed to suppress checking. I would assume that they would be >fairly close. Just a thought.... This is pretty much meaningless. I have access to 3 C compilers on this machine, and the code quality they producve with optimisation switched off is _radically_ different. I just compiled 30 000 lines of C (parts of a program I am trying to install) with these three compilers. Brand X: 747 k Brand Y: 916 k Brand Z: 1091 k This is from the _same_ set of sources exactly. For what it's worth, all three compilers happened to be generating SPARC code, but can generate code for other machines including 80[34...]86. On the SPARC, the Brand Z compiler generates the fastest optimised code, and the Brand X compiler the slowest. With default options, the brand X compiler has the best diagnostics. With the right options, the brandy Y compiler has the best. The brand X compiler compiles the fastest. And to really make the point, Brandy Y (-O2) 650 k Size of compiled code is a function of *compilers*, not *languages*. I see no reason whatsoever to be interested in the size of unoptimised code. The size I care about is the size of the code I actually run, and when using these three compilers I normally ask for a high optimisation level. (In practice I never use less than -O2 for brand Y, and I usually use -xO4 these days for brand Z.) Of these three compilers, the brand X compiler is the *only* one where the size of unoptimised code was something that its authors cared about. I would expect the same to be true for Ada compilers. In fact, since gcc uses the same back end for Ada and C, I would expect unoptimised code from GNAT to be rather bulky, compared with -O2 optimised code. (gcc is brand Y.) -- My tertiary education cost a quarter of a million in lost income (assuming close-to-minimum wage); why make students pay even more? Richard A. O'Keefe; http://www.cs.rmit.edu.au/%7Eok; RMIT Comp.Sci.