Does adding exception handling (try/catch block) affect a programs performance?
Try/catch blocks add a trivial amount of overhead to your programs. In essence, try/catch blocks come free, unless an exception actually throws — handling a thrown exception can be expensive. For that reason, you should use exceptions only to handle error conditions. That is, you should never use exceptions to control program flow. You should also avoid placing try/catch blocks within a loop. Though trivial once, try/catch blocks can add up when performed many times inside a loop.