3 ms·
I think in every modern libc implementation exception handling imposes no extra cost on function calls. In fact, exceptions might well make code faster, as you
by revelation 12y ago
I think in every modern libc implementation exception handling imposes no extra cost on function calls. In fact, exceptions might well make code faster, as you can take a bunch of error checks out of hot code paths. Pretty much the only downside is the complexity of implementing exceptions for libc maintainers and some extra space in the binary to store information that make the stack unwinding possible, but that data is far, far away from the crucial .text.
So exceptions are very expensive when you cause one, but for free or even an improvement when you don't.