Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #330 from u2illc/eq_operator

Improve performance of the Equals operator in the RubyComparable class for objects of different types
  • Loading branch information...
commit e2c37284eaa9b2e59822c9d8448eb98f094b644c 2 parents f94ab12 + 8711597
@headius headius authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/org/jruby/
5 src/org/jruby/
@@ -116,6 +116,11 @@ private static IRubyObject callCmpMethod(ThreadContext context, IRubyObject recv
try {
IRubyObject result = invokedynamic(context, recv, OP_CMP, other);
+ // This is only to prevent throwing exceptions by cmperr - it has poor performance
+ if (result.isNil()) {
+ return returnValueOnError;
+ }
return RubyBoolean.newBoolean(runtime, cmpint(context, result, recv, other) == 0);
} catch (RaiseException e) {
if (e.getException().kind_of_p(context, runtime.getStandardError()).isTrue()) {

1 comment on commit e2c3728


Mind converting the tabs to spaces for consistency?

Please sign in to comment.
Something went wrong with that request. Please try again.