Bridges-Java  3.4.3
Bridges(Java API)
Public Member Functions | List of all members
bridges.benchmark.SortingBenchmark Class Reference
Inheritance diagram for bridges.benchmark.SortingBenchmark:
bridges.benchmark.Benchmark

Detailed Description

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

LineChart lc;
sb.linearRange (100, 1000, 5);
sb.run("mysortingalgorithm", MyClass.mysort);
SortingBenchmark(LineChart p)
Definition: SortingBenchmark.java:52
Author
Erik Saule
Date
07/20/2019

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
 

Constructor & Destructor Documentation

◆ SortingBenchmark()

bridges.benchmark.SortingBenchmark.SortingBenchmark ( LineChart  p)

Member Function Documentation

◆ geometricRange()

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, ...

Parameters
baseSizelower bound of the range sampled
maxSizeupper bound of the range sampled
basebase of the geometric increase

◆ getGenerator()

String bridges.benchmark.SortingBenchmark.getGenerator ( )

◆ linearRange()

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]

Parameters
baseSizelower bound of the range sampled
maxSizeupper bound of the range sampled
nbPointnumber of sample

◆ run()

void bridges.benchmark.SortingBenchmark.run ( String  algoName,
Consumer< int[]>  runnable 
)

benchmark a particular algorithm

Parameters
algoNameScreen name of the algorithm
runnablethe actual algorithm

◆ setBaseSize()

void bridges.benchmark.SortingBenchmark.setBaseSize ( int  size)

Smallest array to be used.

Parameters
sizeof the smallest array to use/

◆ setGenerator()

void bridges.benchmark.SortingBenchmark.setGenerator ( String  generatorName)
Parameters
generatorNamepossible values are "random", "inorder", "reverseorder", "fewdifferentvalues", "almostsorted"

◆ setGeometric()

void bridges.benchmark.SortingBenchmark.setGeometric ( double  base)

Sets a geometric progression for the benchmark size.

Parameters
basenew base of the geometric progression

◆ setIncrement()

void bridges.benchmark.SortingBenchmark.setIncrement ( int  inc)

Sets the increment for the benchmark size.

Parameters
incnew value of the increment

◆ setMaxSize()

void bridges.benchmark.SortingBenchmark.setMaxSize ( int  size)

Puts a cap on the largest array to be used.

Parameters
sizeMaximum size considered

The documentation for this class was generated from the following file: