This is the mail archive of the
mailing list for the GCC project.
Re: C++ exception handling optimization performance
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: David Sankel <david at stellarscience dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Sat, 25 Apr 2015 11:34:50 +0200
- Subject: Re: C++ exception handling optimization performance
- Authentication-results: sourceware.org; auth=none
- References: <553A9223 dot 1040704 at stellarscience dot com>
> Hello all,
> With gcc, does the fact that some branch results in a C++ exception
> effect the performance of a function when that exception branch
> isn't entered? In other words, does the presence of a throw effect
> the optimizer in any way?
EH handling is implemented in a way minimizing performance impact on code paths
not involving exceptions (and having considerable cost when exception is
thrown). It is not fully free however. Presence of throw usually imply presence
of cleanup regions (calling destructors) that increases function size and may
in turn prevent some optimizations over the non-EH path such as inlining,
because code gets too large.
> -- David Sankel
> David Sankel <email@example.com>
> Stellar Science Ltd Co - Stellar Scientific Software Solutions