Run-time overheads

Performance-wise, we have two problems with the existing exception model:

  • Binary code bloat: Just turning on exception support for a program that previously didn't use exceptions at all (that is, isn't throwing or catching anything) will considerably increase the size of the binary. Numbers such as 15% or even 38% were reported.
  • Runtime costs: With today's prevalent table-based exception implementations, there's practically no cost when an exception is not thrown, but there can be a really big runtime overhead when an exception is thrown.

This runtime cost stems from the creation of the exception object, either on heap or, under Windows, on stack, and then the matching of the dynamic exception type using RTTI, which has its own set of performance problems. That does not even mention the stack unwinding!