NextBooleanGenerationPerformance.Sources
, NextBytesGenerationPerformance.Sources
, NextDoubleGenerationPerformance.Sources
, NextFloatGenerationPerformance.Sources
, NextIntGenerationPerformance.Sources
, NextLongGenerationPerformance.Sources
public abstract class BaselineSources
extends java.lang.Object
RandomSource
values.
The state will include only those that do not require additional constructor arguments.
This class is abstract since it adds a special RandomSource
named
BASELINE
. A baseline implementation for the UniformRandomProvider
interface must be provided by implementing classes. For example to baseline methods
using UniformRandomProvider.nextInt()
use the following code:
@State(Scope.Benchmark) public static class Sources extends BaselineSources { @Override protected UniformRandomProvider createBaseline() { return BaselineUtils.getNextInt(); } }
Note: It is left to the implementation to ensure the baseline is suitable for the method being tested.
Constructor | Description |
---|---|
BaselineSources() |
Modifier and Type | Method | Description |
---|---|---|
protected abstract org.apache.commons.rng.UniformRandomProvider |
createBaseline() |
Creates the baseline
UniformRandomProvider . |
org.apache.commons.rng.UniformRandomProvider |
getGenerator() |
Gets the generator.
|
void |
setup() |
Instantiates generator.
|
public org.apache.commons.rng.UniformRandomProvider getGenerator()
public void setup()
protected abstract org.apache.commons.rng.UniformRandomProvider createBaseline()
UniformRandomProvider
.
This should implement the method(s) that will be tested. The speed of this RNG is expected to create a baseline against which all other generators will be compared.
Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.