benchmark: add input "many ascending runs"

This commit is contained in:
Daniel Langbein 2025-01-14 20:42:13 +00:00
parent 4198e28c79
commit e39a8082e3
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002
2 changed files with 13 additions and 4 deletions

View File

@ -18,7 +18,7 @@ import org.openjdk.jmh.annotations.State;
public class JmhCgl extends JmhBase {
// Either all or a selection of input lists.
@Param()
//@Param({"ASCENDING_RUNS", "ASCENDING_RUNS_WITH_OVERLAP"})
//@Param({"ASCENDING_RUNS", "ASCENDING_RUNS_WITH_OVERLAP", "MANY_ASCENDING_RUNS", "MANY_ASCENDING_RUNS_WITH_OVERLAP"})
CglEnum dataEnum;
// Either all or a selection of sort implementations.

View File

@ -8,7 +8,9 @@ public enum CglEnum implements DataEnum {
ASCENDING_INTEGERS,
DESCENDING_INTEGERS,
ASCENDING_RUNS,
ASCENDING_RUNS_WITH_OVERLAP;
ASCENDING_RUNS_WITH_OVERLAP,
MANY_ASCENDING_RUNS,
MANY_ASCENDING_RUNS_WITH_OVERLAP;
@Override
public ObjectSupplier getObjectSupplier() {
@ -17,13 +19,17 @@ public enum CglEnum implements DataEnum {
final long seed = 140506881906827520L; // (long) 'P' * (long) 'O' *(long) 'W' * (long) 'E' * (long) 'R' * (long) 'S' * (long) 'O' * (long) 'R' * (long) 'T';
int listSize = 66_000_000;
int runs = 3010;
int runLength = 3010;
int runs = 3_010;
int runLength = 3_010;
int manyRuns = 30_000;
int shortRunLength = 50;
// Constant factors
double a = 0.96;
double b = 0.25;
double c = 0.81;
double d = 1.0;
return switch (this) {
case RANDOM_INTEGERS -> new RandomIntegers(listSize, seed);
@ -32,6 +38,9 @@ public enum CglEnum implements DataEnum {
case ASCENDING_RUNS -> AscendingRuns.newAscendingRuns(runs, runLength, -1 * runLength);
case ASCENDING_RUNS_WITH_OVERLAP ->
AscendingRuns.newAscendingRuns((int) (c * runs), (int) (c * runLength), (int) (-0.5 * c * runLength));
case MANY_ASCENDING_RUNS -> AscendingRuns.newAscendingRuns(manyRuns, shortRunLength, -1 * shortRunLength);
case MANY_ASCENDING_RUNS_WITH_OVERLAP ->
AscendingRuns.newAscendingRuns((int) (d * manyRuns), (int) (d * shortRunLength), (int) (-0.5 * d * shortRunLength));
};
}
}