Mail Archives: djgpp/2000/03/27/23:36:13
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 -