This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Using exception specifications to help compiler


Inspired by an article by Nathan Sidwell in the proceedings of the GCC 
summit, I experimented a little with adding throw() specifications to some 
500 functions in our library. I estimate that this might cover about a 
third of all small or often called functions for which I would expect this 
to be significant.

The results are the following: file sizes are slightly reduced on average, 
but run-time increases by about 1.5 per cent (details below).

Question: Is this to be expected? I was under the impression that giving 
the compiler more information should help it optimize, not make it 
harder.

W.


In detail: sizes of 3 shared libraries in debug mode (.g.so) and optimized 
(.so) as well as a single executable in optimized mode (stripped). All 
data with present mainline:
                        without     with       change
                 exception specifications     
    libbase.g.so        5444792   5370385      -1.4%
    liblac.g.so         5311878   5195292      -2.2%
    libdeal_II_2d.g.so 19915788  19116902      -4.2%
    libbase.so          1645513   1663428      +1.1%
    liblac.so           1469093   1503466      +2.2%
    libdeal_II_2d.so    3881274   3774751      -2.8%
    step-14              155824    153776      -1.3%


Here are run-times (CPU time):
  without exception specifications:
     4m7.130s
     4m7.760s
     4m7.620s
     4m7.630s    ----> 247.5s +- 0.2s
  with exception specifications:
     4m11.380s
     4m11.590s
     4m11.480s   ----> 251.5s +- 0.1s  -----> +1.5%

-------------------------------------------------------------------------
Wolfgang Bangerth              email:            bangerth@ices.utexas.edu
                               www: http://www.ices.utexas.edu/~bangerth/



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]