Re: Clarification of C++ kernel development issues
Posted: Fri Jan 29, 2021 8:50 am
Exactly. You shouldn't concentrate on the performance of the component that is rarely run. You need to measure the whole impact of using exceptions, and one of those impacts is in the common case, you get to run whole swathes of code without having to check (and branch) for errors. Fewer pipeline hazards, fewer instructions to execute. It may be a marginal instantaneous performance improvement, but the cumulative effect may well negate any performance impact of an expensive exception unwind mechanism.nullplan wrote:Yes. I can't find the stats right now, but if the exception triggers, the latency is orders of magnitude above the other error handling methods. The "zero cost" exception handling model is especially bad about this, since in that case once the exception starts you have to start reading tables. And reading DWARF2 debug information in order to unwind the stack. Error code handling is way better optimized. And the costs of error codes vs. "zero cost" if no exception happens doesn't appear to be all that bad. Not orders of magnitude, certainly.thewrongchristian wrote:Do they have terrible performance, though?
However, it usually doesn't matter because exceptions should be rare.