comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@cs.nyu.edu (Robert Dewar)
Subject: Re: Ada vs. C
Date: 1996/08/10
Date: 1996-08-10T00:00:00+00:00	[thread overview]
Message-ID: <dewar.839724011@schonberg> (raw)
In-Reply-To: 4uj16j$ivv@news.pacifier.com


Here is some realistic data on comparing C and Ada. The programs I 
compared are:

In Ada

procedure f is
   procedure printf (s : string);
   pragma Import (C, printf, "printf");
begin
   printf ("Hello World!");
end f;


In C

#include <stdio.h>
main(int argc, char *argv[], char *envp[])
{
   printf("hello world\n");
}


The stripped executables compiled by gcc are of course identical in
size as one would expect, 24580 bytes in either case.

I used printf in both programs so that they are exactly comparable. Now
of course if you include an additional package in the Ada version, like
GNAT.IO, then you will find that the Ada program gets bigger, it goes
up to 32772 bytes.

The additional 8200 bytes represents not some mysterious Ada inefficiency
but simply the size of this package, since it is linked statically and
not dynamically.

If we use the more complex package Text_IO, then the size gets larger still,
up to 53252 bytes. Once again, the extra 28K bytes simply represents the
size of the Text_IO package. Not surprisingly it is larger than the
simple GNAT.IO package since it has far more capability (it also uses
some of the other Ada library facilities like finalization support).

I can of course (since gcc allows mixed language programming) make a C
program which uses Text_IO facilities, guess how big it is -- that's right
53252 bytes (what a surprise :-)

I suppose these figures may surprise some people, but to me it would
be surprising if comparable C and Ada programs were NOT the same size!





  reply	other threads:[~1996-08-10  0:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-08-07  0:00 Ada vs. C The Quelisher
1996-08-09  0:00 ` Jack W Scheible
1996-08-09  0:00 ` Daniel P Hudson
1996-08-09  0:00   ` Robert Dewar
1996-08-09  0:00 ` Robert Dewar
1996-08-09  0:00   ` The Quelisher
1996-08-10  0:00     ` Bob Kitzberger
1996-08-10  0:00     ` steved
1996-08-10  0:00       ` Robert Dewar [this message]
1996-08-10  0:00     ` Robert Dewar
1996-08-11  0:00     ` Jerry van Dijk
1996-08-11  0:00     ` Dave Wood
1996-08-14  0:00       ` busigin
1996-08-16  0:00         ` Robert Dewar
1996-08-12  0:00   ` Vladimir Vukicevic
  -- strict thread matches above, loose matches on Subject: below --
1995-01-20  4:43 "Subtract C, add Ada" Samuel Mize
1995-01-21 20:28 ` David O'Brien
     [not found]   ` <3g655n$q5k@theopolis.orl.mmc.com>
1995-01-30 15:33     ` Ada vs. C Martijn Bak
replies disabled

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