Using exception specifications to help compiler
Wolfgang Bangerth
bangerth@ices.utexas.edu
Thu Jun 5 14:59:00 GMT 2003
> The compiler can optimize successfully only if all functions called by
> the "throw ()" function also have "throw ()" -- or can be inlined, and
> do do not throw exceptions.
>
> I suspect that in your case, you have something like:
>
> void f();
> void g() throw () { f(); }
>
> In that case, the "throw ()" on "g" will actually make it bigger -- it
> must now catch any exception thrown by "f" and call "unexpected". That
> would possibly also account for the slowdown, if you got worse cache
> performance.
I was aware of that, so I started bottom-up. Most of the functions I
marked were small accessor functions and functions that do not call other
functions.
> The other possibility is that the additional "throw ()" specifications
> are causing the compiler to do more inlining, which is causing worse
> performance in your particular case.
I don't think that was the case, since code size actually decreased.
Any more hints?
Thanks
W.
-------------------------------------------------------------------------
Wolfgang Bangerth email: bangerth@ices.utexas.edu
www: http://www.ices.utexas.edu/~bangerth/
More information about the Gcc
mailing list