comp.lang.ada
 help / color / mirror / Atom feed
From: ok@goanna.cs.rmit.EDU.AU (Richard A. O'Keefe)
Subject: Re: Ada vs. C: performance, size
Date: 1997/01/13
Date: 1997-01-13T00:00:00+00:00	[thread overview]
Message-ID: <5bcdjo$s82$1@goanna.cs.rmit.EDU.AU> (raw)
In-Reply-To: 9701092022.AA15007@most


>Date:         Thu, 9 Jan 1997 10:20:07 -0800
>From: "Chris Sparks (Mr. Ada)" <sparks@AISF.COM>

>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.




  parent reply	other threads:[~1997-01-13  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-01-09  0:00 Ada vs. C: performance, size W. Wesley Groleau (Wes)
1997-01-10  0:00 ` Robert Dewar
1997-01-10  0:00   ` Stephen Leake
1997-01-13  0:00 ` Richard A. O'Keefe [this message]
  -- strict thread matches above, loose matches on Subject: below --
1997-01-09  0:00 W. Wesley Groleau (Wes)
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox