On 12/7/05, Andreas Killaitis <[EMAIL PROTECTED]> wrote: > Hello list, > > I have a question concerning the size of the code generated by gcc > 4.0.2 and 4.1. > We talk about a C++ app with many smaller (30k) or larger (4M) C++ > libraries. > Being happy the size of those libs decreased by about 20% when > switching from > gcc 3.4.4 to gcc 4.0.2 (introducing --visibility-inlines-hidden), I > was now astonished > that my tests with gcc 4.1 showed that the library size has been > grown by about 10%. > The compiler parameters have not been changed for this test and the > test has been > done on the same system, so it must be related to gcc. Is this a > regression, a feature > (possibly better code inlining) or just the fact that gcc 4.0.2 is a > release version and > the gcc 4.1 was just a snapshot? Nevertheless, the generated code > runs about 3% faster than the 4.0.2 code, so there's nothing to > complain. > > The used compile options are: > > -ftemplate-depth-32 > -finline-functions > -finline-limit-100000
Instead of arbitrary raising the inlining limit (where the meaning of 100000 changed significantly between 3.4 and 4.0 and again 4.0 and 4.1), you could try benefiting from profile-based inlining. I.e. remove this parameter completely and compile your libraries with -fprofile-generate / -fprofile-use. Richard. > -O3 > -march=athlon-mp > -ftracer > -fvisibility-inlines-hidden > -ftree-vectorize > -pipe > > > Andreas Killaitis >