From: Bryce Bardin <bbardin@home.com>
Subject: Re: Gnat Executable Size
Date: 1998/10/11
Date: 1998-10-11T00:00:00+00:00 [thread overview]
Message-ID: <3620F843.39465221@home.com> (raw)
In-Reply-To: 6volj0$250$1@uuneo.neosoft.com
Robert B. Love wrote:
>
> Over in the Modula-2 newsgroup somebody was asking about free compilers.
> Another person pointed out GNAT as suitable for his task and free.
> Ada vs. M2 wasn't the issue. The original poster said he'd tried GNAT
> on a simple "hello world" program and was surprised to see a 200K
> executable. Others said their favorite M2 compiler yielded about 10K
> executables for this.
This is a naive view of program size. The size of executables depend on
several factors, including:
1) the target machine architecture;
2) the size and complexity of the program source code;
3) the amount of debugging information included, if any;
4) the degree and kinds of optimization performed by the compilation
system and linker; and
5) the size of any libraries used (which must be bound into the
image).
Let us assume that you want to make a "fair" comparison between two
languages, comparing "oranges" with "oranges" and "apples" with
"apples".
Then you need to control all of the above factors, and make
sure that the programs really are doing the same work:
1) use the same target (this is easy);
2) make sure the program has as nearly as possible the same
semantic
effect in both languages (this is *much* harder than it appears at
first sight);
3) make sure that debugging information is stripped out (easy);
4) compile and build using the options that lead to the smallest
executable size (which will, in general, be *slower* to execute
and may change the semantics of the program!) (this is
non-trivial);
and
5) use libraries with identical or very similar capabilities
(again hard to do between languages).
In comparing languages with differing semantics, the issue of program
behavior under stress must be accounted for. For example, in Ada,
many checks that help to improve robustness are performed, both at
compile-time and at run-time. If the comparison language doesn't
perform similar checks, then the comparison may be unfair (and there
ain't no such thing as a free lunch, or in this case, a free check).
Since most languages don't perform similar checks automatically,
usually checks are turned off in the Ada executable to improve the
comparison. This defeats much of the ability for a well-designed Ada
program to perform reliably, but brings the semantics closer to the
norm for most other languages.
Making sure that no debugging information is included is often
overlooked. Making sure that the "best" size optimizations are
performed
can be surprisingly difficult. You need to understand how both
compilation systems work and all of the options quite well in order to
do this correctly.
But the most difficult (and at the same time the easiest) parameter to
control is the size of the libraries bound into the image. The
capabilities of Ada's Text_Io package are much more sophisticated
than those of other languages' I/O libraries, so the Ada library size
will inevitably be larger. On the other hand, an Ada program using I/O
can be made more reliable.
If the only measure of size that you use is the size of the "standard"
"hello world" program, Ada will always lose!
But there is also a simple way of making the comparison *very* fair:
use the same library!
In Ada, import the other languge's I/O library and call it the
same way the other languges does. Then the executable sizes will
be *very* similar (and in the case of gcc and gnat, the executables
may, in fact, actually be identical).
In the end, however, the best measure of executable size will not be a
trivial program like "hello world", because most programs are not that
small and simple.
This is just one of the reasons why both hardware and software vendors
and sophisticated developers find both hardware and application and
development software benchmark testing to be a difficult and frustrating
task.
(snip)
>
> ----------------------------------------------------------------
> Bob Love MIME & NeXT Mail OK
> rlove@neosoft.com
> ----------------------------------------------------------------
next prev parent reply other threads:[~1998-10-11 0:00 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-10-10 0:00 Gnat Executable Size Robert B. Love
1998-10-11 0:00 ` Bryce Bardin [this message]
1998-10-12 0:00 ` Donald Duck
1998-10-14 0:00 ` geertbosch
1998-10-14 0:00 ` dewar
1998-10-15 0:00 ` Donald Duck
1998-10-16 0:00 ` Gnat Free ? Donald Duck
1998-10-16 0:00 ` dewar
1998-10-16 0:00 ` Pascal Obry
1998-10-16 0:00 ` Donald Duck
1998-10-16 0:00 ` dewar
1998-10-19 0:00 ` Pascal Obry
1998-10-19 0:00 ` dewar
1999-02-13 0:00 ` Fred J. McCall
1998-10-16 0:00 ` dennison
1998-10-16 0:00 ` Ronald Cole
1998-10-16 0:00 ` Andi Kleen
1998-10-17 0:00 ` dewarr
1998-10-18 0:00 ` Jonathan Guthrie
1998-10-18 0:00 ` Ronald Cole
1998-10-19 0:00 ` dewar
1998-10-21 0:00 ` Ronald Cole
1998-10-19 0:00 ` dewar
1998-10-18 0:00 ` Brian Rogoff
1998-10-19 0:00 ` Jonathan Guthrie
1998-10-18 0:00 ` Brian Rogoff
1998-10-19 0:00 ` dewar
1998-10-19 0:00 ` Andi Kleen
1998-10-19 0:00 ` dewar
1998-10-23 0:00 ` Bruno BEAUFILS
1998-10-25 0:00 ` dewar
1998-10-19 0:00 ` dewar
1998-10-17 0:00 ` Jerry van Dijk
1998-10-18 0:00 ` Andi Kleen
1998-10-18 0:00 ` Ronald Cole
1998-10-19 0:00 ` Jerry van Dijk
1998-10-20 0:00 ` dennison
1998-10-17 0:00 ` dewarr
1998-10-17 0:00 ` The Ludwig Family
1998-10-18 0:00 ` dewar
1998-10-19 0:00 ` Dale Pontius
1998-10-19 0:00 ` dewar
1998-10-18 0:00 ` Ronald Cole
1998-10-19 0:00 ` dewarr
1998-10-21 0:00 ` Ronald Cole
1998-10-19 0:00 ` Ronald Cole
1998-10-19 0:00 ` dewarr
1998-10-23 0:00 ` system
1998-10-16 0:00 ` dewar
1998-10-17 0:00 ` David C. Hoos, Sr.
1998-10-17 0:00 ` Jean-Pierre Rosen
1998-10-11 0:00 ` Gnat Executable Size Lieven Marchand
1998-10-13 0:00 ` Robert B. Love
1998-10-11 0:00 ` Niklas Holsti
1998-10-11 0:00 ` Corey Minyard
1998-10-12 0:00 ` Andi Kleen
1998-10-12 0:00 ` dennison
1998-10-12 0:00 ` Dave Wood
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox