mirror of
https://gitlab.uni-marburg.de/langbeid/powersort.git
synced 2025-01-22 19:55:44 +01:00
benchmark: refactor
This commit is contained in:
parent
8e20550b44
commit
a945a3278e
@ -1,9 +1,10 @@
|
|||||||
package de.uni_marburg.powersort.benchmark;
|
package de.uni_marburg.powersort.benchmark;
|
||||||
|
|
||||||
import de.uni_marburg.powersort.TimSort;
|
import de.uni_marburg.powersort.sort.DummySort;
|
||||||
|
import de.uni_marburg.powersort.sort.MergeSort;
|
||||||
|
import de.uni_marburg.powersort.sort.TimSort;
|
||||||
import de.uni_marburg.powersort.data.RandomIntegers;
|
import de.uni_marburg.powersort.data.RandomIntegers;
|
||||||
import org.openjdk.jmh.annotations.*;
|
import org.openjdk.jmh.annotations.*;
|
||||||
import org.openjdk.jmh.infra.Blackhole;
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@ -28,16 +29,15 @@ public class BenchmarkJmh {
|
|||||||
@BenchmarkMode(Mode.AverageTime)
|
@BenchmarkMode(Mode.AverageTime)
|
||||||
@OutputTimeUnit(TimeUnit.MILLISECONDS)
|
@OutputTimeUnit(TimeUnit.MILLISECONDS)
|
||||||
@Benchmark
|
@Benchmark
|
||||||
public void rand1DummySort(State1 s, Blackhole bh) {
|
public void rand1DummySort(State1 s) {
|
||||||
DummySort.sort(s.a, 0, s.a.length, NaturalOrder.INSTANCE, null, 0, 0);
|
DummySort.sort(s.a, 0, s.a.length, NaturalOrder.INSTANCE, null, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@BenchmarkMode(Mode.AverageTime)
|
@BenchmarkMode(Mode.AverageTime)
|
||||||
@OutputTimeUnit(TimeUnit.MILLISECONDS)
|
@OutputTimeUnit(TimeUnit.MILLISECONDS)
|
||||||
@Benchmark
|
@Benchmark
|
||||||
public void rand1TimSort(State1 s, Blackhole bh) {
|
public void rand1TimSort(State1 s) {
|
||||||
TimSort.sort(s.a, 0, s.a.length, NaturalOrder.INSTANCE, null, 0, 0);
|
TimSort.sort(s.a, 0, s.a.length, NaturalOrder.INSTANCE, null, 0, 0);
|
||||||
bh.consume(s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@BenchmarkMode(Mode.AverageTime)
|
@BenchmarkMode(Mode.AverageTime)
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package de.uni_marburg.powersort.benchmark;
|
package de.uni_marburg.powersort.benchmark;
|
||||||
|
|
||||||
import de.uni_marburg.powersort.TimSort;
|
import de.uni_marburg.powersort.sort.DummySort;
|
||||||
|
import de.uni_marburg.powersort.sort.MergeSort;
|
||||||
|
import de.uni_marburg.powersort.sort.TimSort;
|
||||||
import de.uni_marburg.powersort.data.DescendingIntegers;
|
import de.uni_marburg.powersort.data.DescendingIntegers;
|
||||||
import de.uni_marburg.powersort.data.RandomIntegers;
|
import de.uni_marburg.powersort.data.RandomIntegers;
|
||||||
import de.uni_marburg.powersort.data.ObjectSupplier;
|
import de.uni_marburg.powersort.data.ObjectSupplier;
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.uni_marburg.powersort;
|
package de.uni_marburg.powersort.sort;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a near duplicate of {@link TimSort}, modified for use with
|
* This is a near duplicate of {@link TimSort}, modified for use with
|
@ -1,4 +1,4 @@
|
|||||||
package de.uni_marburg.powersort.benchmark;
|
package de.uni_marburg.powersort.sort;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@ -8,7 +8,7 @@ import java.util.Comparator;
|
|||||||
* <p>
|
* <p>
|
||||||
* Uses Arrays.sort() for sorting.
|
* Uses Arrays.sort() for sorting.
|
||||||
*/
|
*/
|
||||||
class DummySort {
|
public class DummySort {
|
||||||
public static <T> void sort(T[] a, int lo, int hi, Comparator<? super T> c,
|
public static <T> void sort(T[] a, int lo, int hi, Comparator<? super T> c,
|
||||||
T[] work, int workBase, int workLen) {
|
T[] work, int workBase, int workLen) {
|
||||||
assert lo == 0;
|
assert lo == 0;
|
@ -1,4 +1,4 @@
|
|||||||
package de.uni_marburg.powersort.benchmark;
|
package de.uni_marburg.powersort.sort;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
@ -1,4 +1,4 @@
|
|||||||
package de.uni_marburg.powersort.benchmark;
|
package de.uni_marburg.powersort.sort;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package de.uni_marburg.powersort;
|
package de.uni_marburg.powersort.sort;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
@ -24,7 +24,7 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.uni_marburg.powersort;
|
package de.uni_marburg.powersort.sort;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user