comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: Executable File Size Differences
Date: 1996/10/11
Date: 1996-10-11T00:00:00+00:00	[thread overview]
Message-ID: <EACHUS.96Oct10204102@spectre.mitre.org> (raw)
In-Reply-To: 52bmn5$7r0@sjx-ixn6.ix.netcom.com



   I said:

   >     Note that with dynamic linking and first reference traps or a
   > similar mechanism, all the pain goes away, and you can have an
   > executable for Hello World that is under 50 bytes--in any language.


In article <Pine.GSO.3.93.961006144724.15733A-100000@sky.net> John Howard <jhoward@sky.net> writes:

  > We can always benefit from smaller executables.  And we need the option to 
  > share DLL's.  But we should not have to use a DLL in order to quote a 
  > smaller size for an executable...

   No DLL in sight!  The trick is that with first reference traps all
the (Text_IO) variables never referenced in this program are actually
initialized by the first reference traps.  The compiler front-end
may generate code to update all this junk (column number, line number,
page number, etc.), but since there are no visible references, the
compiler backend can (and will) delete all the assignments to them.
Now all we are left with is a single in-lined system call to write a
string literal to standard out.

   Actually, hmmm...

with System;
procedure Syswrite is
   use System;
   procedure system(X: in Address);
   pragma Interface(C, system);
   Temp: String(1..20) := "echo ""Hello World!""" & Ascii.Nul;
begin
   System(Temp'Address);
end Syswrite;

with Text_IO;
procedure Hello is
begin Text_IO.Put_Line("Hello World!"); end Hello;

  SunAda (VADS):

-rw-r--r--  1 eachus        226 Oct 10 19:37 syswrite.a
-rw-r--r--  1 eachus         85 Oct 10 19:43 hello.a
-rwxr-xr-x  1 eachus      81920 Oct 10 19:40 SYSWRITE
-rwxr-xr-x  1 eachus     270336 Oct 10 19:44 HELLO

  GNAT 3.05 on SunOS 4.1.3:

-rw-r--r--  1 eachus        219 Oct 10 20:15 syswrite.adb
-rw-r--r--  1 eachus         93 Oct 10 20:01 hello.adb
-rwxr-xr-x  1 eachus      65536 Oct 10 20:15 syswrite
-rwxr-xr-x  1 eachus     286720 Oct 10 20:05 hello

   (Slight differences in sources sizes are because I eliminated the
constraint on Temp and added "Ada." to Text_IO for GNAT.  Force of habit. ;-)

   Well there is a lot of extra stuff in there still.  Anyone want to try
some more?

--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...




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

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-09-25  0:00 Executable File Size Differences Robert P. Kuzmicki
1996-09-25  0:00 ` Georgi Savov
1996-09-28  0:00   ` Stanley Allen
1996-09-28  0:00     ` Robert Dewar
1996-09-30  0:00     ` Richard A. O'Keefe
1996-10-01  0:00       ` Ken Cowan
1996-10-03  0:00         ` Stanley Allen
1996-10-04  0:00           ` Ada 95 - Performance vs. Pervasiveness (was: Executable File Size Diff Larry Kilgallen
1996-10-02  0:00   ` Executable File Size Differences Robert I. Eachus
1996-10-06  0:00     ` John Howard
1996-09-28  0:00 ` Simon FitzMaurice
1996-10-02  0:00 ` Jon S Anthony
1996-10-11  0:00 ` Robert I. Eachus [this message]
  -- strict thread matches above, loose matches on Subject: below --
1996-09-28  0:00 Robert Dewar
1996-09-28  0:00 ` Tony Picarello
1996-09-29  0:00 tmoran
1996-09-29  0:00 ` Robert Dewar
replies disabled

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