Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f3f577605ad3
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f434a33bbcb2
Choose a head ref
  • 3 commits
  • 2 files changed
  • 2 contributors

Commits on Jun 9, 2016

  1. Use Java's Arrays.sort

    Java's Arrays.sort more robust and is faster is certain cases.
    
    See #3919 and
    https://github.com/sri/jruby-sort-benchmark.
    sri committed Jun 9, 2016
    Copy the full SHA
    5502160 View commit details

Commits on Jun 15, 2016

  1. Deprecate the Qsort class

    sri committed Jun 15, 2016
    2
    Copy the full SHA
    192f7a3 View commit details
  2. Merge pull request #3961 from sri/use-java-native-sort

    Use Java's Arrays.sort
    enebo authored Jun 15, 2016
    Copy the full SHA
    f434a33 View commit details
Showing with 3 additions and 4 deletions.
  1. +2 −3 core/src/main/java/org/jruby/RubyArray.java
  2. +1 −1 core/src/main/java/org/jruby/util/Qsort.java
5 changes: 2 additions & 3 deletions core/src/main/java/org/jruby/RubyArray.java
Original file line number Diff line number Diff line change
@@ -58,7 +58,6 @@
import org.jruby.runtime.opto.Invalidator;
import org.jruby.util.ByteList;
import org.jruby.util.Pack;
import org.jruby.util.Qsort;
import org.jruby.util.RecursiveComparator;
import org.jruby.util.TypeConverter;
import org.jruby.util.io.EncodingUtils;
@@ -3276,7 +3275,7 @@ private IRubyObject sortInternal(final ThreadContext context, boolean honorOverr
final boolean stringBypass = !honorOverride || runtime.getString().isMethodBuiltin("<=>");

try {
Qsort.sort(values, begin, begin + realLength, new Comparator() {
Arrays.sort(values, begin, begin + realLength, new Comparator() {
public int compare(Object o1, Object o2) {
if (fixnumBypass && o1 instanceof RubyFixnum && o2 instanceof RubyFixnum) {
return compareFixnums((RubyFixnum) o1, (RubyFixnum) o2);
@@ -3311,7 +3310,7 @@ private IRubyObject sortInternal(final ThreadContext context, final Block block)
int length = realLength;

safeArrayCopy(values, begin, newValues, 0, length);
Qsort.sort(newValues, 0, length, new Comparator() {
Arrays.sort(newValues, 0, length, new Comparator() {
public int compare(Object o1, Object o2) {
IRubyObject obj1 = (IRubyObject) o1;
IRubyObject obj2 = (IRubyObject) o2;
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/util/Qsort.java
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@
import java.util.ArrayList;
import java.util.Comparator;

@Deprecated
public class Qsort {
private static final int SIZE_THRESHOLD = 16;

@@ -287,4 +288,3 @@ private static void swap(Object[] a, int i, int j) {
a[j] = t;
}
}