Skip to content

Instantly share code, notes, and snippets.

@cheald
Created June 17, 2015 23:24
Show Gist options
  • Save cheald/e93f9c86ef89912b9e8e to your computer and use it in GitHub Desktop.
Save cheald/e93f9c86ef89912b9e8e to your computer and use it in GitHub Desktop.
diff --git a/core/src/main/java/org/jruby/RubyArray.java b/core/src/main/java/org/jruby/RubyArray.java
index 4148045..20765e48 100644
--- a/core/src/main/java/org/jruby/RubyArray.java
+++ b/core/src/main/java/org/jruby/RubyArray.java
@@ -2797,7 +2797,10 @@ public class RubyArray extends RubyObject implements List, RandomAccess {
IRubyObject tmp;
while (i < ary.realLength) {
IRubyObject elt = ary.values[ary.begin + i++];
- tmp = TypeConverter.checkArrayType(elt);
+
+ tmp = context.nil;
+ if(elt.respondsTo("to_ary"))
+ tmp = TypeConverter.checkArrayType(elt);
if (tmp.isNil() || (level >= 0 && stack.realLength / 2 >= level)) {
result.append(elt);
} else {
before
bin/jruby --dev -e "require 'active_support/all'; p ActiveSupport" 10.14s user 0.40s system 176% cpu 5.980 total
bin/jruby --dev -e "require 'active_support/all'; p ActiveSupport" 9.87s user 0.28s system 187% cpu 5.415 total
bin/jruby --dev -e "require 'active_support/all'; p ActiveSupport" 10.46s user 0.36s system 185% cpu 5.848 total
bin/jruby --dev -e "require 'active_support/all'; p ActiveSupport" 9.92s user 0.31s system 186% cpu 5.474 total
after
bin/jruby --dev -e "require 'active_support/all'; p ActiveSupport" 8.89s user 0.28s system 186% cpu 4.922 total
bin/jruby --dev -e "require 'active_support/all'; p ActiveSupport" 8.68s user 0.26s system 183% cpu 4.866 total
bin/jruby --dev -e "require 'active_support/all'; p ActiveSupport" 9.61s user 0.35s system 188% cpu 5.286 total
bin/jruby --dev -e "require 'active_support/all'; p ActiveSupport" 9.70s user 0.30s system 187% cpu 5.338 total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment