Archived

This topic is now archived and is closed to further replies.

Exception handling

This topic is 5501 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

quote:
Original post by ChaosEngine
theoretical question: how much of a performance impact do exceptions have? Is it better to use return codes?


Exceptions are usually implemented so as to give as little overhead as possible (normally), and then take a bigger performance hit if an exception is actually raised.

That said, using exceptions is known to break optimization paths in some cases which could hurt (if an exception is raised, the execution has to be broken cleanly and a jump to a different part of the code needs to be possible without breaking things). Here is a small note about it on one compiler.

I''d defenitely suggest against using exceptions in a high-performance application since enabling exceptions cause a slowdown and as it''s impossible to disable them just for certain parts.

Share this post


Link to post
Share on other sites