delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/27/23:36:13

From: Nate Eldredge <neldredge AT hmc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: EXE files too big!
Date: 27 Mar 2000 13:40:24 -0800
Organization: InterWorld Communications
Lines: 50
Message-ID: <83aejkccs7.fsf@mercury.st.hmc.edu>
References: <8bjhuu$8pt$1 AT newssrv DOT otenet DOT gr> <o0mqdskei6jkr3or9b64skepq1ja7h5dsm AT 4ax DOT com> <38DECB5D DOT 3C38247B AT gtcom DOT net>
NNTP-Posting-Host: mercury.st.hmc.edu
Mime-Version: 1.0
X-Trace: nntp1.interworld.net 954193324 62031 134.173.45.219 (27 Mar 2000 21:42:04 GMT)
X-Complaints-To: usenet AT nntp1 DOT interworld DOT net
NNTP-Posting-Date: 27 Mar 2000 21:42:04 GMT
User-Agent: Gnus/5.0802 (Gnus v5.8.2) Emacs/20.5
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Krogg <krogg DOT no DOT to DOT spam AT gtcom DOT net> writes:

> Upx is great...I have even comprerssed some of the other executables on
> my system with it....but,you can get even smaller .exe's using the
> -s switch AND upx.
> 
> Plain compile of a simple program......120503 bytes
> With the -s switch               .......58880 bytes
> plain compile + upx              .......34028 bytes
> -s switch + upx                  .......34008 bytes
> 
> Its not a huge difference with this particular program
> so i will try another.
> 
> Plain compile of a simple program......537804 bytes
> With the -s switch               ......289792 bytes
> plain compile + upx              ......123416 bytes
> -s switch + upx                  ......123400 bytes
> 
> hmmmm....I thought i was making a point but it looks
> like you only save a few bytes with using both...still
> there are a FEW bytes saved....

Normally compressors will strip the debug info (which is what -s does)
before attempting compression, since if you're compressing it, you
probably care about size and not debugging.  So I'm not surprised that
they should be very similar.  With DJP, I seem to recall the results
were the same.

> I am gonna try one more thing....
> Ok i tried the -s switch and the -O2 switch AND upx.
> ended up with..........................119268 bytes
> 
> Now,that IS a little better...Now someone is gonna
> tell me that the -O2 switch is some kind of bad thing
> that i will wish i hadnt ever heard of......

-O2 is fine; it optimizes the code, which often makes it smaller.  -O3
will do inlining, which generally makes the code larger and sometimes
even slower (because of cache effects).  So -O2 is best for most
purposes.

Development versions of GCC have the -Os switch, which will optimize
for size at the possible expense of speed.  I believe that at present
it doesn't do very much, however.

-- 

Nate Eldredge
neldredge AT hmc DOT edu

- Raw text -


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