I as concerned about whether the presence of rescue
in Ruby had significant performance impact.
In JavaScript for example try/catch historically has had significant impact itself, even when no exceptions were being thrown.
Based on these benchmarks though, I can see Ruby doesn't seem to have significant cost for defining exception handlers.
Calculating -------------------------------------
exception 136415 i/100ms
break 138364 i/100ms
return 137073 i/100ms
-------------------------------------------------
exception 4168999.4 (±2.5%) i/s - 20871495 in 5.009678s
break 4300029.8 (±2.8%) i/s - 21584784 in 5.023858s
return 4173625.1 (±1.8%) i/s - 20972169 in 5.026599s
Based off of http://blog.honeybadger.io/benchmarking-exceptions-in-ruby-yep-theyre-slow/ , which measures the cost of using exceptions (not my concern- exceptions are rare, I just wanted to know cost of the handler).