Large code size?

David B. Rees dbr@spoke.nols.com
Wed Mar 31 23:46:00 GMT 1999


On 24-Mar-99 Sam Lantinga wrote:
> I'm comparing code size of an application compiled with VC++ and with egcs,
> 1.1.1 and the VC++ binary is smaller than the egcs binary by an almost exact
> factor of two.  The code being compared is self-contained, i.e. it calls no
> library routines internally, and is pretty hairy C++ template code.
> 
> The egcs version (compiled with egcs 1.1.1, -O2 -funroll-loops):
> -rwxrwxr-x   1 hercules devel     1534443 Mar 25  1999 robotcom.so
> 
> The VC++ version (compiled with VC++ 5.0, /G5 /Ox /Ot /Og /Oi /Op /Ob2)
> -r-xr-xr-x   1 hercules devel      654336 Mar 14 10:26 robotcom.dll
> 
> Any ideas why this might be?  The same ratio is true for the main
> application, which is 13 MB on Linux, and 6 MB on Windows.  7 MB
> of difference makes a significant impact on performance, and our
> application compares poorly to the Windows version.  We'd like it
> to compare favorably. :)
> 
> Your thoughts, O Gurus? :)

Did you try running strip on the library?  Also, compiling with the flag -Os
should optimize the code for size, instead of speed.

-Dave



More information about the Gcc mailing list