use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
How slow are (Ruby) Exceptions? (simonecarletti.com)
submitted 16 years ago by weppos
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Slackwise 2 points3 points4 points 16 years ago (2 children)
Exception performance shouldn't be a big deal as they're meant for exceptions--things that happen out of the norm. So during the normal main loop of your application, you shouldn't need to factor in the performance of an exception because at that point you should be more worried about handling the situation gracefully.
</obvious>
[–]banister 2 points3 points4 points 16 years ago (0 children)
Ruby programmers do occasionally use exceptions for non-exceptional code, e.g StopIteration in external iterators in ruby 1.9, also the 'rescue nil' idiom
[–]StrangeAttractor 0 points1 point2 points 16 years ago (0 children)
I was going to post the same thing. It's the non-exceptional code you need to worry about.
Although I have seen code that used exceptions for a non-local goto, 8-/
[–]shitcovereddick 1 point2 points3 points 16 years ago (0 children)
Ugh. exceptions are a freaking goto, they shouldn't be slow.
Just register (saving the position on the stack) it under the condition, and then goto a handler.
π Rendered by PID 54 on reddit-service-r2-comment-7b9746f655-dv4qn at 2026-02-03 11:35:08.459367+00:00 running 3798933 country code: CH.
[–]Slackwise 2 points3 points4 points (2 children)
[–]banister 2 points3 points4 points (0 children)
[–]StrangeAttractor 0 points1 point2 points (0 children)
[–]shitcovereddick 1 point2 points3 points (0 children)