Skip to content
This repository

Improve performance of the Equals operator in the RubyComparable class for objects of different types #330

Merged
merged 1 commit into from over 1 year ago

3 participants

Kamil Bednarz Kevin Menard Charles Oliver Nutter
Kamil Bednarz

Please see the following ticket for all the details:
http://jira.codehaus.org/browse/JRUBY-6915

Charles Oliver Nutter headius merged commit e2c3728 into from October 05, 2012
Charles Oliver Nutter headius closed this October 05, 2012
Kevin Menard

Mind converting the tabs to spaces for consistency?

Kamil Bednarz

nirvdrum,

Thanks for your remark.
I created a pull request, that fixes the indentation: #337

BTW, I deleted my previous message - I misunderstood you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Oct 02, 2012
Kamil Bednarz Added workaround to prevent throwing exceptions when using == operato…
…r on objects of different types.
8711597
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 5 additions and 0 deletions. Show diff stats Hide diff stats

  1. 5  src/org/jruby/RubyComparable.java
5  src/org/jruby/RubyComparable.java
@@ -116,6 +116,11 @@ private static IRubyObject callCmpMethod(ThreadContext context, IRubyObject recv
116 116
         try {
117 117
             IRubyObject result = invokedynamic(context, recv, OP_CMP, other);
118 118
 
  119
+			// This is only to prevent throwing exceptions by cmperr - it has poor performance
  120
+			if (result.isNil()) {
  121
+				return returnValueOnError;
  122
+			}
  123
+
119 124
             return RubyBoolean.newBoolean(runtime, cmpint(context, result, recv, other) == 0);
120 125
         } catch (RaiseException e) {
121 126
             if (e.getException().kind_of_p(context, runtime.getStandardError()).isTrue()) {
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.