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

Added option to disable runtime exceptions #10

Merged
merged 2 commits into from
Mar 31, 2016
Merged

Added option to disable runtime exceptions #10

merged 2 commits into from
Mar 31, 2016

Conversation

effata
Copy link

@effata effata commented Sep 17, 2015

This pull request adds the option disable_visit_errors, which disables the raising of errors during runtime. Parse errors will still be raised, but all exceptions during Node.visit(object) are disabled and nil is returned instead.

We process very large amounts of data and sometimes objects do not have quite the right properties. So we have to catch InvalidArityError and InvalidTypeError since there is no way to preemptively check for these errors. This has quite a large overhead, especially in JRuby.

I did some benchmarks with objects that always result in an exception, and this branch had a 40% speed increase in MRI, and a 500% increase in JRuby.
When not raising errors, there's no measurable difference between this branch and master, and also no difference between disable_visit_errors being off or on.

David Dahl added 2 commits September 17, 2015 11:19
This adds a way to disable all errors during the .visit(object) stage. Parse errors will still be raised, but runtime exceptions such as values being of the wrong type for a function will be ignored. Benchmarks show a 40% speedup in MRI and 500% in JRuby.
@trevorrowe
Copy link
Contributor

Sorry for the slow turn-around on this. I had a change to update the jmespath gem to the latest compliance tests, add support for the new features and I took the opportunity to test this and merge it in. Thanks for the contribution. This should go out with a new release shortly.

@trevorrowe trevorrowe merged commit fe05ff2 into jmespath:master Mar 31, 2016
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

Successfully merging this pull request may close these issues.

2 participants