Dear java-gnome-developer,
Would you like to reduce the size of your generated shared object file
by as mush as 90% ? If you do then read on, because I want to share a
technique I've just discovered. And it's *free* of all charge!!!!
First, you should know that including <gtk/gtk/h> when you are only
using a GtkButton is waste of resource. If you actually only use
GtkButton, just include <gtk/gtkbutton.h>, the size of the object file
will be drastically smaller. And compilation will be faster. I will
post a patch to clean includes in the BTS.
New versions of gcc use the DWARF2 debugging format by default instead
of stabs. DWARF2 is theoretically more compact than stabs, but by
default debugging info for all the symbols encountered during
compilation is produced, even for the symbols which are not
used. Also, the gcc implementation of DWARF2 does not by default
eliminate duplicate debugging info. So if you include <gtk/gtk.h> in
each every c file, you end up with debugging info for all the symbols
in <gtk/gtk.h> multiplied by the number of c files. The use of the
-feliminate-dwarf2-dups flag can fix that.
I also discovered that gcc version 3.4 is about 30% faster than
version 3.3.
Here are few numbers comparing before and after (use f gcc 3.4 with
-feliminate-dwarf2-dups and only include the necessary header files):
before after
compile time 2m20sec 1m5sec
.so size 27M 2.4M
du -hs libgtk-java/src/jni/ 60M 17M
Dear sir, I hope you are now convinced and will chose to follow my proven
method.
Sincerely yours,
Laurent Martelli
--
Laurent Martelli
la...@ao... Java Aspect Components
http://www.aopsys.com/ http://jac.objectweb.org
|