delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/12/00:32:15

From: mert0407 AT sable DOT ox DOT ac DOT uk (George Foot)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Simple == Big
Date: 10 Oct 1997 13:50:10 GMT
Organization: Oxford University, England
Message-ID: <61lbqi$d1b$2@news.ox.ac.uk>
References: <19971010014900 DOT VAA05748 AT ladder02 DOT news DOT aol DOT com>
NNTP-Posting-Host: sable.ox.ac.uk
Lines: 35
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Myknees (myknees AT aol DOT com) wrote:
: Now here's the kicker.  I also added the -O3 option, and the resulting
: executable was still the same size.  Does this mean that all simple
: programs compiled with djgpp will always be inordinately large?

Yup. Not that large though... A very simple program which just prints a
string on the screen and then quits can be as small as 30k IIRC. The `-s'
option should have reduced your file size a bit; try running `strip' on the
executable, which has the same effect.

However, there is a certain amount of startup information and support code
which must be present to take care of a few things... locating a DPMI
server, the switch to protected mode, the command line interpretation,
loading of environment from DJGPP.ENV, etc. You can turn some of these
features off as explained in the FAQ, which will further reduce your code
size.

The real problem, though, is that your program isn't a sensible test of the
compiler's code generation. It's not particularly useful, it doesn't benefit
at all from running in protected mode, and some of the program is no doubt
simply dead weight. When you write longer programs, though, they will not
increase in size so quickly; most of your code at present is one-off
information that is included in every executable.

Bottom line: If you want to improve the library_code:program_code ratio of
your programs, write more program code and stop worrying about it :)

Also, you might like to get hold of a copy of DJP, the executable file
compresser for djgpp programs. It's in a zip calls mlp???b.zip somewhere on
the FTP sites (sorry, I can't give an exact reference ATM; no doubt the FAQ
points to it).

-- 
George Foot <mert0407 AT sable DOT ox DOT ac DOT uk>
Merton College, Oxford

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019