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,63bbc3281a2f80ea X-Google-Attributes: gid103376,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: Ada vs. C Date: 1996/08/10 Message-ID: #1/1 X-Deja-AN: 173450633 references: <3208F2BA.E34@freenet.scri.fsu.edu> <320B693F.4ACA@freenet.scri.fsu.edu> <4uj16j$ivv@news.pacifier.com> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-08-10T00:00:00+00:00 List-Id: 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 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!