comp.lang.ada
 help / color / mirror / Atom feed
From: John Howard <jhoward@sky.net>
Subject: Re: GNAT Codesize
Date: 1996/06/24
Date: 1996-06-24T00:00:00+00:00	[thread overview]
Message-ID: <Pine.GSO.3.93.960624191009.17694A-100000@sky.net> (raw)
In-Reply-To: 835637893.1349.0@assen.demon.co.uk


-- Filename: mini.adb
procedure mini is
begin
  null;
end mini;

>gnatmake mini

The DJGPP version (GNAT v3.05) produces:
MINI     ADB        46   6-22-96  4:38p
MINI     ALI       117   6-22-96  4:39p
MINI     O         400   6-22-96  4:39p
MINI     EXE     47104   6-22-96  4:40p

The OS/2 version (GNAT v3.05) produces:
 6-22-96   4:38p        46           0  MINI.ADB
 6-22-96   4:42p       117           0  mini.ali
 6-22-96   4:42p       130           0  mini.o
 6-22-96   4:42p     56298           0  mini.exe

There is an article in July 1996 Embedded Systems Programming which refers
to people using the codesize of "Hello, world" to help gauge the quality
of a compiler.  Most of us want our programs to be as small as possible. 
By todays standards most of us recognize that a 250 KB "Hello, world" 
program is too bloated.  Heck, all it must do is print one line of text.

Some observations about "Hello, world" in the P.J. Plauger article:
Unix C produces a few hundred bytes.  Using printf bloats the codesize to
around 10 KB.  Typical C++ produces around 250 KB.  Optimized C++ produces 
around 50 KB.

Below are my Turbo Pascal and two GNAT v3.05 results.

program HelloWorld;
begin
  writeln('Hello, world');
end.

>tpc hello.pas

The Borland Turbo Pascal v7.0 produces:
HELLO    EXE      2192   6-24-96  7:33p

There are two keys to producing smaller executables.  One is to strip the 
executable of debug information.  The other key is to use a smart linker.

TP7 uses a smart linker and defaults to producing a stripped executable. 
Ideally we want GNAT to use a smart linker that only pulls in data that is
actually referenced.  ( There should also be some pragmas to tell the
compiler and linker to create a DLL instead of an Executable.  TP7 can 
produce a 16-bit DLL that works under either DOS protected mode interface 
or Windows or OS/2. )

-- Filename: hello.adb
with Text_IO;
procedure hello is
begin
  Text_IO.Put_Line("Hello, world");
end hello;

>gnatmake hello

The DJGPP version (GNAT v3.05) produces:
HELLO    ADB        91   6-24-96  8:21p
HELLO    ALI       749   6-24-96  8:39p
HELLO    O         519   6-24-96  8:39p
HELLO    EXE     83456   6-24-96  8:40p

The OS/2 version (GNAT v3.05) produces:
HELLO    ADB        91   6-24-96  8:21p
HELLO    ALI       749   6-24-96  8:22p
HELLO    O         237   6-24-96  8:22p
HELLO    EXE    263355   6-24-96  8:22p

The OS/2 GNAT unstripped executable codesize is like typical C++ 
bloatware.  It would be an embarassment to distribute bloatware when
demonstrating an example of Ada 95 advantages.  Bloatware is a stigma that
reinforces the idea of inefficient code produced by poor compilers and/or
inept programmers.

------------------------------------------------------------------------
-- John Howard <jhoward@sky.net>               -- Team OS/2  Team Ada --





  reply	other threads:[~1996-06-24  0:00 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-06-20  0:00 GNAT Codesize Haug Buerger
1996-06-20  0:00 ` James E. Hopper
1996-06-21  0:00 ` Doug Smith
1996-06-21  0:00 ` Ralph Paul
1996-06-21  0:00 ` Robert Dewar
1996-06-24  0:00   ` John McCabe
1996-06-24  0:00     ` John Howard [this message]
1996-06-25  0:00       ` David J. Fiander
1996-06-25  0:00       ` Robert Dewar
1996-06-26  0:00     ` Robert Dewar
1996-06-28  0:00       ` Fergus Henderson
1996-07-01  0:00         ` Michael Feldman
1996-07-03  0:00           ` John McCabe
1996-07-02  0:00         ` John McCabe
1996-07-03  0:00           ` Robert Dewar
1996-07-06  0:00             ` John McCabe
1996-07-06  0:00               ` Robert Dewar
1996-07-06  0:00               ` Michael Feldman
1996-07-08  0:00             ` Gavin Smyth
1996-06-28  0:00       ` John McCabe
1996-06-28  0:00         ` Fergus Henderson
1996-06-29  0:00           ` John McCabe
1996-07-01  0:00             ` Robert Dewar
1996-07-05  0:00               ` John McCabe
1996-07-05  0:00             ` JP Thornley
1996-06-30  0:00         ` Robert Dewar
1996-07-02  0:00           ` John McCabe
1996-07-03  0:00             ` Robert Dewar
1996-07-03  0:00   ` Question about the need for requeue as described in Rationale James A. Squire
1996-07-05  0:00     ` Bo I. Sanden
1996-07-05  0:00       ` progers
1996-07-06  0:00     ` Robert A Duff
1996-07-04  0:00   ` Samuel Tardieu
1996-07-04  0:00     ` Robert Dewar
1996-07-08  0:00   ` James A. Squire
1996-07-09  0:00     ` progers
1996-07-10  0:00     ` Robert A Duff
1996-07-10  0:00       ` progers
1996-07-08  0:00   ` James A. Squire
1996-07-08  0:00     ` Robert A Duff
1996-07-09  0:00     ` Bo I. Sanden
1996-07-08  0:00   ` James A. Squire
1996-07-09  0:00   ` Jon S Anthony
1996-07-08  0:00 ` James A. Squire
replies disabled

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