Fw: gcc 3.2 code bloating?

Miguel Ramírez mramirez@iua.upf.es
Wed Oct 9 01:51:00 GMT 2002


----- Original Message -----
From: Miguel Ramírez
To: linuxeros-upf@iua.upf.es
Cc: gcc-help@gcc.gnu.org
Sent: Wednesday, October 09, 2002 9:39 AM
Subject: gcc 3.2 code bloating?


Example code:

#include <iostream>

int main( int argc, char** argv )
{

 std::cout << "MinGW says hello to you" << std::endl;

 return 0;
}

and its corresponding makefile:

CC=g++
CFLAGS=-g -Wall
LDFLAGS=
PROGRAM=test
OSEXECEXT=.exe

all: $(PROGRAM)

clean:
 rm *.$(OSEXECEXT)

$(PROGRAM): test.cxx
 $(CC) -o $@ $(CFLAGS) $<

Results of the build on Win2k with mingw3.2 ( gcc 3.2 ):

mramirez@APDIUA1 /c/mingw_tests
$ ls -la
total 639
drwxr-xr-x    2 mramirez Administ     4096 Oct  9 07:30 .
drwxr-xr-x  100 mramirez Administ    40960 Oct  9 07:22 ..
-rw-r--r--    1 mramirez Administ      154 Oct  9 07:25 Makefile
-rw-r--r--    1 mramirez Administ      135 Oct  9 07:29 test.cxx
-rwxr-xr-x    1 mramirez Administ  1259581 Oct  9 07:29 test.exe

Results with Debian 3.0 with gcc 2.95 :
SID@rivendel:~/exec_size$ ls -la
total 16
drwx------    2 mramirez iua            47 Oct  9 09:24 .
drwx-----x   36 mramirez iua          4096 Oct  9 09:24 ..
-rwx------    1 mramirez iua           154 Oct  9  2002 Makefile
-rwxr-xr-x    1 mramirez iua         19124 Oct  9 09:24 test
-rwx------    1 mramirez iua           135 Oct  9 09:24 test.cxx

Please note the executable size.

My hypothesis are the following:

    i) far too many templates instantiated due to including the <iostream>
    ii) since the binutils are implemented on top of Windoze base services
there's an
        overhead of about 20 k

My training as programmer has conditioned me to think about big executables
as
generally evil ( bigger process = slower context switching ). What can I do
to alleviate
this effect?

Miguel Ramírez.



More information about the Gcc-help mailing list