[AD] Bloat Issues

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hi,

My executables are coming out much larger now.  Before I was using
Allegro 3.1 (I think - if WIPs around 3.9.14 report as 3.1 in
allegro.h then it may be a WIP).  Now I'm using 3.9.31.

It's not just allegro that's changed - my older library was compiled
with gcc 2.7.2, the new one with 2.95.2.  And my DJGPP compilers are
different versions too.  My own code is compiled with 2.95.2 in both
case - I'm just linking with an older library in one case.

Looking at the link maps (link with "gcc -Wl,-M  ...  2> linkmap")
it looks like lots of object files I'm not using is being pulled in
because other bits of liballeg.a reference symbols in these object
files.

For example, I make no use of sound but I'm getting sound and midi
stuff pulled in.  This appears to be because install_allegro in
allegro.c calls _midi_constructor().  It's not clear to me what this
function is for, so I'm not sure what the best way to avoid this is.
Generally the approach to take is to use a lazy initialisation rather
than called an initialiser explicitly (i.e. use a flag variable to
initialise the module the first time it is used).

To give some idea of how much the bloat is I used a bit of perl to
total up the sizes of the objects pulled in I find that:

allegro 3.1:    628,888 bytes
allegro 3.9.31: 895,881 bytes

That's an increase of 266,993 bytes.  My executable has grown from
387,584 to 629,248 i.e. by 241,664 bytes.

Interestingly liballeg.a itself has increased from 1,010,844 to
1,063,038 (i.e. by just 52,194 bytes).

It's probably the case that the executables will be a little larger
with the newer version - after all Allegro is doing more in the the
sections of the library I am using.  But a 62% increase in size seems
unreasonable.

Thoughts?

Cheers,
Olly



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/