Bridges-Java
3.4.3
Bridges(Java API)
|
Benchmarks sorting algorithm.
Benchmarks sorting algorithms and add time series to a LineChart.
The benchmark goes from an initial size controlled by setBaseSize() to a largest size controlled by setMaxSize(). One can also set a maximum time spent on a particular run using setTimeCap().
The benchmark goes from a array size of n to the next one of geoBase * n + increment, where the base is controlled by setGeometric() and increment is controlled by setIncrement(). For simpler use one can set a purley linear sampling with linearRange() or a purely geometric one with geometricRange().
The sorting algorithms must have for prototype: static void mysort(int[]); and can be passed to the run function for being benchmarked. A typical use would look something like
Public Member Functions | |
SortingBenchmark (LineChart p) | |
void | setMaxSize (int size) |
Puts a cap on the largest array to be used. More... | |
void | setBaseSize (int size) |
Smallest array to be used. More... | |
void | setIncrement (int inc) |
Sets the increment for the benchmark size. More... | |
void | setGeometric (double base) |
Sets a geometric progression for the benchmark size. More... | |
void | linearRange (int baseSize, int maxSize, int nbPoint) |
The benchmark will sample a range with a fixed number of points. More... | |
void | geometricRange (int baseSize, int maxSize, double base) |
The benchmark will sample a range using in geometrically increasing sequence. More... | |
void | setGenerator (String generatorName) |
String | getGenerator () |
void | run (String algoName, Consumer< int[]> runnable) |
benchmark a particular algorithm More... | |
Public Member Functions inherited from bridges.benchmark.Benchmark | |
void | setTimeCap (long cap_in_ms) |
sets an upper bound to the time of a run. More... | |
long | getTimeCap () |
Return time limit of a run. More... | |
Additional Inherited Members | |
Package Functions inherited from bridges.benchmark.Benchmark | |
Benchmark (LineChart plot, long timeCap) | |
Benchmark (LineChart plot) | |
Package Attributes inherited from bridges.benchmark.Benchmark | |
LineChart | plot |
bridges.benchmark.SortingBenchmark.SortingBenchmark | ( | LineChart | p | ) |
void bridges.benchmark.SortingBenchmark.geometricRange | ( | int | baseSize, |
int | maxSize, | ||
double | base | ||
) |
The benchmark will sample a range using in geometrically increasing sequence.
The benchmark will sample the range [baseSize; maxSize] using a geometric distribution in base base. That is to say, it will sample baseSize, base*baseSize, base*base*baseSize, ...
baseSize | lower bound of the range sampled |
maxSize | upper bound of the range sampled |
base | base of the geometric increase |
String bridges.benchmark.SortingBenchmark.getGenerator | ( | ) |
void bridges.benchmark.SortingBenchmark.linearRange | ( | int | baseSize, |
int | maxSize, | ||
int | nbPoint | ||
) |
The benchmark will sample a range with a fixed number of points.
The benchmark will sample about nbPoint equally distributed in the range [baseSize; maxSize]
baseSize | lower bound of the range sampled |
maxSize | upper bound of the range sampled |
nbPoint | number of sample |
void bridges.benchmark.SortingBenchmark.run | ( | String | algoName, |
Consumer< int[]> | runnable | ||
) |
benchmark a particular algorithm
algoName | Screen name of the algorithm |
runnable | the actual algorithm |
void bridges.benchmark.SortingBenchmark.setBaseSize | ( | int | size | ) |
Smallest array to be used.
size | of the smallest array to use/ |
void bridges.benchmark.SortingBenchmark.setGenerator | ( | String | generatorName | ) |
generatorName | possible values are "random", "inorder", "reverseorder", "fewdifferentvalues", "almostsorted" |
void bridges.benchmark.SortingBenchmark.setGeometric | ( | double | base | ) |
Sets a geometric progression for the benchmark size.
base | new base of the geometric progression |
void bridges.benchmark.SortingBenchmark.setIncrement | ( | int | inc | ) |
Sets the increment for the benchmark size.
inc | new value of the increment |
void bridges.benchmark.SortingBenchmark.setMaxSize | ( | int | size | ) |
Puts a cap on the largest array to be used.
size | Maximum size considered |