[cfe-dev] Can noexcept impair performance?

Stephan Tolksdorf st at quanttec.com
Sun Feb 10 07:11:46 PST 2013


Hi,

I'm asking this question on this list because answering it requires 
knowledge of compiler internals and it may be of general interest to C++ 
programmers, so I hope you don't consider it off-topic.

I know that there are situations where a noexcept declaration can 
improve performance, because such a declaration may enable specialized 
code paths in library code or additional compiler optimizations.

I wonder whether there are also situations where a noexcept declaration 
could impair performance. For example, I could imagine that a noexcept 
declaration might complicate or even suppress inlining if the compiler 
can't prove that the function code can never throw. Could this happen 
with Clang?

Thanks in advance for any hint.

Best regards,
   Stephan





More information about the cfe-dev mailing list