benchmark: numbers

This commit is contained in:
Daniel Langbein 2024-12-17 16:28:01 +00:00
parent dbf26421d9
commit b730c34ddd
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002
3 changed files with 19 additions and 14 deletions

View File

@ -22,9 +22,9 @@ import java.util.concurrent.TimeUnit;
/* /*
* Benchmark parameters * Benchmark parameters
*/ */
@Fork(0) @Fork(1)
@Warmup(iterations = 0) @Warmup(iterations = 1)
@Measurement(iterations = 1) @Measurement(iterations = 6)
@BenchmarkMode(Mode.AverageTime) @BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS) @OutputTimeUnit(TimeUnit.MILLISECONDS)
/* /*

View File

@ -15,6 +15,7 @@ public class Main {
final EnumSet<SortEnum> sortImplementations = getSortImplementations(); final EnumSet<SortEnum> sortImplementations = getSortImplementations();
final EnumSet<DataEnum> dataEnums = getSortInputSuppliers(); final EnumSet<DataEnum> dataEnums = getSortInputSuppliers();
System.out.println();
for (DataEnum dataEnum : dataEnums) { for (DataEnum dataEnum : dataEnums) {
ObjectSupplier objectSupplier = dataEnum.getObjectSupplier(); ObjectSupplier objectSupplier = dataEnum.getObjectSupplier();
System.out.println(dataEnum); System.out.println(dataEnum);
@ -32,6 +33,7 @@ public class Main {
final String durFormatted = LongFormatter.formatUnderscore(durMillis); final String durFormatted = LongFormatter.formatUnderscore(durMillis);
System.out.println(durFormatted + "," + sortImplementation); System.out.println(durFormatted + "," + sortImplementation);
} }
System.out.println();
} }
} }

View File

@ -1,26 +1,29 @@
package de.uni_marburg.powersort.data; package de.uni_marburg.powersort.data;
public enum DataEnum { public enum DataEnum {
RANDOM_INTEGERS, RANDOM_INTEGERS_300M,
ASCENDING_INTEGERS, ASCENDING_INTEGERS_300M,
DESCENDING_INTEGERS, DESCENDING_INTEGERS_250M,
ASCENDING_RUNS, ASCENDING_RUNS_1M,
ASCENDING_RUNS_WITH_OVERLAP; ASCENDING_RUNS_WITH_OVERLAP_1M;
public ObjectSupplier getObjectSupplier() { public ObjectSupplier getObjectSupplier() {
// We use a seed to get the same random list every time -> Repeatable benchmarks on same input data! // We use a seed to get the same random list every time -> Repeatable benchmarks on same input data!
// final long seed = 3651660232967549736L; // System.nanoTime() ++ Math.random() // final long seed = 3651660232967549736L; // System.nanoTime() ++ Math.random()
final long seed = 140506881906827520L; // (long) 'P' * (long) 'O' *(long) 'W' * (long) 'E' * (long) 'R' * (long) 'S' * (long) 'O' * (long) 'R' * (long) 'T'; final long seed = 140506881906827520L; // (long) 'P' * (long) 'O' *(long) 'W' * (long) 'E' * (long) 'R' * (long) 'S' * (long) 'O' * (long) 'R' * (long) 'T';
int longListSize = 50_000_000; int longListSize = 300_000_000; // Any larger: Out of Heap Space. TODO GRADLE config
int middleListSize = 250_000_000;
int runs = 1000;
int runLength = 1000;
return switch (this) { return switch (this) {
case RANDOM_INTEGERS -> new RandomIntegers(longListSize, seed); case RANDOM_INTEGERS_300M -> new RandomIntegers(longListSize, seed);
case ASCENDING_INTEGERS -> new AscendingIntegers(longListSize); case ASCENDING_INTEGERS_300M -> new AscendingIntegers(longListSize);
case DESCENDING_INTEGERS -> new DescendingIntegers(longListSize); case DESCENDING_INTEGERS_250M -> new DescendingIntegers(middleListSize);
case ASCENDING_RUNS -> AscendingRuns.newAscendingRuns(10_000, 10_000, -10_000); case ASCENDING_RUNS_1M -> AscendingRuns.newAscendingRuns(runs, runLength, -runLength);
case ASCENDING_RUNS_WITH_OVERLAP -> AscendingRuns.newAscendingRuns(10_000, 10_000, -5_000); case ASCENDING_RUNS_WITH_OVERLAP_1M -> AscendingRuns.newAscendingRuns(runs, runLength, (int) (-0.5 * runLength));
}; };
} }
} }