Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exceptions are used for control flow in non-bang methods #254

Open
mjc opened this issue May 14, 2015 · 2 comments
Open

Exceptions are used for control flow in non-bang methods #254

mjc opened this issue May 14, 2015 · 2 comments

Comments

@mjc
Copy link
Contributor

mjc commented May 14, 2015

JSON::Validator.validate still uses exceptions internally for control flow.

This is a bug as exceptions have performance implications on MRI and dramatic performance implications on JRuby. See this PR for an example of a 9x speedup on JRuby from removing raise/rescue from the hot path in an already highly-optimized library.

I would be happy to start working on fixing this but it seems like a big undertaking and I want to be sure others agree this is worthwhile.

The solution I plan to implement is to make bang methods that wrap non-bang methods and add exceptions, rather than the other way around as is currently implemented.

@kwando
Copy link

kwando commented May 21, 2015

@mjc it is a good idea change this like you suggest

@iainbeeston
Copy link
Contributor

Yes I'm totally behind this if you have a plan.

Also it might be worth a quick look at #239 where I've tried to clean up
the existing error handling
On Thu, 21 May 2015 at 9:16 pm, Hannes Nevalainen [email protected]
wrote:

@mjc https://github.com/mjc it is a good idea change this like you
suggest


Reply to this email directly or view it on GitHub
#254 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants