@@ -74,7 +74,7 @@ class SorterSuite extends FunSuite {
7474 * Note that the Java implementation varies tremendously between Java 6 and Java 7, when
7575 * the Java sort changed from merge sort to Timsort.
7676 */
77- test (" Sorter benchmark" ) {
77+ ignore (" Sorter benchmark" ) {
7878
7979 /** Runs an experiment several times. */
8080 def runExperiment (name : String )(f : => Unit ): Unit = {
@@ -96,21 +96,9 @@ class SorterSuite extends FunSuite {
9696 val numElements = 25000000 // 25 mil
9797 val rand = new XORShiftRandom (123 )
9898
99- // Test primitive sort on float array
100- val primitiveKeys = Array .tabulate[Float ](numElements) { i => rand.nextFloat() }
101- runExperiment(" Java Arrays.sort() on primitive keys" ) {
102- Arrays .sort(primitiveKeys)
103- }
104-
105- // Test non-primitive sort on float array
10699 val keys = Array .tabulate[JFloat ](numElements) { i =>
107100 new JFloat (rand.nextFloat())
108101 }
109- runExperiment(" Java Arrays.sort()" ) {
110- Arrays .sort(keys, new Comparator [JFloat ] {
111- override def compare (x : JFloat , y : JFloat ): Int = Ordering .Float .compare(x, y)
112- })
113- }
114102
115103 // Test our key-value pairs where each element is a Tuple2[Float, Integer)
116104 val kvTupleArray = Array .tabulate[AnyRef ](numElements) { i =>
@@ -123,17 +111,29 @@ class SorterSuite extends FunSuite {
123111 })
124112 }
125113
126- // Test our Sorter where each element alternates between Float and Integer, non-primitive.
114+ // Test our Sorter where each element alternates between Float and Integer, non-primitive
127115 val keyValueArray = Array .tabulate[AnyRef ](numElements * 2 ) { i =>
128116 if (i % 2 == 0 ) keys(i / 2 ) else new Integer (i / 2 )
129117 }
130-
131118 val sorter = new Sorter (new KVArraySortDataFormat [JFloat , AnyRef ])
132119 runExperiment(" KV-sort using Sorter" ) {
133120 sorter.sort(keyValueArray, 0 , keys.length, new Comparator [JFloat ] {
134121 override def compare (x : JFloat , y : JFloat ): Int = Ordering .Float .compare(x, y)
135122 })
136123 }
124+
125+ // Test non-primitive sort on float array
126+ runExperiment(" Java Arrays.sort()" ) {
127+ Arrays .sort(keys, new Comparator [JFloat ] {
128+ override def compare (x : JFloat , y : JFloat ): Int = Ordering .Float .compare(x, y)
129+ })
130+ }
131+
132+ // Test primitive sort on float array
133+ val primitiveKeys = Array .tabulate[Float ](numElements) { i => rand.nextFloat() }
134+ runExperiment(" Java Arrays.sort() on primitive keys" ) {
135+ Arrays .sort(primitiveKeys)
136+ }
137137 }
138138}
139139
0 commit comments