delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/04/21/00:16:41

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: "Pierre Laroche" <pierrel AT deltanet DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Creating small-sized EXE
Date: 20 Apr 2002 18:02:48 GMT
Organization: Concentric Internet Services
Lines: 99
Message-ID: <a9sag8$o9s@dispatch.concentric.net>
References: <a9eqki$9s9$1 AT violet DOT singnet DOT com DOT sg>
NNTP-Posting-Host: 64.1.213.19
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Try using the strip utility to reduce the exe size further.

- Pierre

"Goh, Yong Kwang" <gohyongkwang AT hotmail DOT com> wrote in message
news:a9eqki$9s9$1 AT violet DOT singnet DOT com DOT sg...
> I've noticed that the simple program that I write when compiled are way
much
> larger than other people's program with similar capabilities and function,
> possibly compiled with other C compiler. For example, for a simple Hello
> World program,
>
> #include <stdio.h>
>
> main(){
>     printf("Hello World\n");
>     return 0;
> }
>
> when compiled using DJGPP gcc, comes up to about 80KB. When checking out
the
> binary utilities supplied with DJGPP, I come across merge.exe and
split.exe.
> Both took up only about 30KB each. As a test I wrote a C program (I simply
> call it FileJoin) to do the same thing as merge.exe (with slight
differences
> in the way parameters are arranged) and it ends up as a 80KB EXE, more
than
> 2x the size of merge.exe! Notice the difference? 2 programs with almost
> similar capabilities but with a huge difference in size? Why so? A quick
> check of the djgpp/bin and /windows/command directory throws up lots of
> programs which do more useful things and with a lot more sophistication
than
> my humble HelloWorld or FileJoin program and many of them are still
smaller
> in size. I'm sure you would agree that XCOPY.EXE (30KB), CWSDPMI.EXE
(20KB),
> GO32-V2.EXE (62KB) all does sophisticated stuffs and they're still small
in
> size. Size does matter ;) after all and I'm always impressed by small and
> nimble command-line programs that load fast and do their work fast,
instead
> of showing me eye-candies like full color icons, transparent buttons,
> animated windows with drop shadows or a bother-some agent with speech
> synthesis offering "help" in the corner. Looks fun at first, but you get
> weary after an hour or so.
>
> A lot of people argues that the overhead (standard library routines plus
the
> stub) is of little concern as disk space is cheap nowadays with 40GB hard
> disks and as the program gets bigger, the proportion of the starting
> overhead to the actual program code is minimal, so what's a few KB?
However,
> I'm still concern that a simple program doing a simple task should not be
> unnecessarily big -- the size has to be in proportion to what a program
can
> accomplish. IMHO, I consider anything that uses up more computing
resources
> than what it *should* require a bloatware. Why would we need 80KB just to
> print only "Hello World" on the screen? Yes disk space and memory is cheap
> but not free or infinite. I just want to cultivate the habit of writing
> compact and speedy code instead of hogging unnecessary resources. 1 or 2
> bloatware programs are probably fine but consider this for DOS
> Terminate-Stay-Residents, Unix daemon processes or Windows services, with
> probably a hundred of them residing in memory in the background and
forking
> out more processes as they're activated, the computer will be struggling
> under all these over-sized programs and we take a performance hit. Just my
> opinion. Please don't flame or "attack" me.
>
> I wonder if the problem lies with my program design or programming style?
Or
> is it that I've not instructed gcc via some switches, which apparently I'm
> not aware of, to do code optimization for generation of compact code,
> leading gcc to include some debugging info in the EXE?
>
> And any tips to reduce EXE size to the minimum, for example, by not
linking
> in unused routines/libraries etc and by changing program design etc? And
is
> it time I should start learning x86 assembly language programming instead
of
> mucking around in C/C++ :=)?
>
> Thanks.
> --
> Yong-Kwang Goh
> Singapore
> gohyongkwang AT hotmail DOT com
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/02
>
>


- Raw text -


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