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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6ff6ac051491e437 X-Google-Attributes: gid103376,public From: John Howard Subject: Re: GNAT Codesize Date: 1996/06/24 Message-ID: #1/1 X-Deja-AN: 161958475 references: <31c8fdd4.5a455349@zesi.ruhr.de> <835637893.1349.0@assen.demon.co.uk> content-type: TEXT/PLAIN; charset=US-ASCII organization: SkyNET Corporation mime-version: 1.0 reply-to: John Howard newsgroups: comp.lang.ada Date: 1996-06-24T00:00:00+00:00 List-Id: -- 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 -- Team OS/2 Team Ada --