Need help in understanding performance gains.

Oleg Endo oleg.endo@t-online.de
Tue Jul 1 07:40:00 GMT 2014


Hello,

On 01 Jul 2014, at 06:54, vijay nag <vijunag@gmail.com> wrote:

> Hello GCC,
> 
> Gcc upgrade from 3.3.2(i586 target) to 4.7.2(i686) is yielding a
> performance gain of around 20% in our code base.
> 
> It would be interesting to know where/how exactly the code has been
> optimized by the latest compiler. What is the best way to know where
> exactly the newer compiler has performed better than the older one ?
> In general, when a compiler is upgraded how do we make a comparative
> study between the old and the new one ?

This is difficult to answer without knowing the details of your code base.
It could be that one particular optimization that is done by the 4.7 compiler
causes the 20% improvement.  It could also be different optimizations playing
together to your benefit.
You can compare the assembler output of the compilers by using e.g. the
-save-temps option, although that might be impractical for large code bases.
Alternatively you can go through the release notes of each version from 3.3.2
on (e.g. https://gcc.gnu.org/gcc-4.7/changes.html) and extract the optimizations
that have been added in each version and which options are available to control
them (https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#Optimize-Options).
Then, disable those optimizations and observe the effects on your code base.

Cheers,
Oleg


More information about the Gcc-help mailing list