Package stdlib
Class DoublingTest
java.lang.Object
stdlib.DoublingTest
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addOps
(int count) During a doubling test, the provided code may callincOps
and/oraddOps
.static void
incOps()
During a doubling test, the provided code may callincOps
and/oraddOps
.static void
run
(int initialValue, int numValues, int numTestsPerValue, Consumer<Integer> setup, Consumer<Integer> timed) See fully parameterizedrun
for a description.static <T> void
run
(int initialValue, int numValues, int numTestsPerValue, Function<Integer, T> setup, BiConsumer<Integer, T> timed) Run the functiontimed
with increasing large values for the first integer parameter (N).static <T> void
run
(int initialValue, int numValues, int numTestsPerValue, Function<Integer, T> setup, Consumer<T> timed) See fully parameterizedrun
for a description.static void
See fully parameterizedrun
for a description.static void
See fully parameterizedrun
for a description.static <T> void
run
(int initialValue, int numValues, Function<Integer, T> setup, BiConsumer<Integer, T> timed) See fully parameterizedrun
for a description.static <T> void
See fully parameterizedrun
for a description.static void
runLong
(long initialValue, int numValues, int numTestsPerValue, Consumer<Long> setup, Consumer<Long> timed) See fully parameterizedrunLong
for a description.static <T> void
runLong
(long initialValue, int numValues, int numTestsPerValue, Function<Long, T> setup, BiConsumer<Long, T> timed) Run the functiontimed
with increasing large values for the first integer parameter (N).static <T> void
runLong
(long initialValue, int numValues, int numTestsPerValue, Function<Long, T> setup, Consumer<T> timed) See fully parameterizedrunLong
for a description.static void
See fully parameterizedrunLong
for a description.static void
See fully parameterizedrunLong
for a description.static <T> void
runLong
(long initialValue, int numValues, Function<Long, T> setup, BiConsumer<Long, T> timed) See fully parameterizedrunLong
for a description.static <T> void
See fully parameterizedrunLong
for a description.private static <T> void
runOnce
(int value, int numTestsPerValue, Function<Integer, T> setup, BiConsumer<Integer, T> timed) private static <T> void
runOnce
(long value, int numTestsPerValue, Function<Long, T> setup, BiConsumer<Long, T> timed)
-
Field Details
-
time
-
ops
-
-
Constructor Details
-
DoublingTest
public DoublingTest()
-
-
Method Details
-
incOps
During a doubling test, the provided code may callincOps
and/oraddOps
. If either is called, then the number of operations so recorded will be reported byrun
. -
addOps
During a doubling test, the provided code may callincOps
and/oraddOps
. If either is called, then the number of operations so recorded will be reported byrun
. -
run
See fully parameterizedrun
for a description. In this abbreviated form,numTestsPerValue
is 1.setup
does nothing, therefore no value is provided totimed
. -
run
public static void run(int initialValue, int numValues, Consumer<Integer> setup, Consumer<Integer> timed) See fully parameterizedrun
for a description. In this abbreviated form,numTestsPerValue
is 1. No value is passed fromsetup
totimed
. -
run
public static void run(int initialValue, int numValues, int numTestsPerValue, Consumer<Integer> setup, Consumer<Integer> timed) See fully parameterizedrun
for a description. In this abbreviated form, no value is passed fromsetup
totimed
. -
run
public static <T> void run(int initialValue, int numValues, Function<Integer, T> setup, BiConsumer<Integer, T> timed) See fully parameterizedrun
for a description. In this abbreviated form,numTestsPerValue
is 1. -
run
public static <T> void run(int initialValue, int numValues, int numTestsPerValue, Function<Integer, T> setup, Consumer<T> timed) See fully parameterizedrun
for a description. In this abbreviated form, the integer value is not passed totimed
. -
run
public static <T> void run(int initialValue, int numValues, Function<Integer, T> setup, Consumer<T> timed) See fully parameterizedrun
for a description. In this abbreviated form,numTestsPerValue
is 1. The integer value is not passed totimed
. -
run
public static <T> void run(int initialValue, int numValues, int numTestsPerValue, Function<Integer, T> setup, BiConsumer<Integer, T> timed) Run the functiontimed
with increasing large values for the first integer parameter (N). Running time is reported to the console. Initial value of N is given byinitialValue
. N doubles each time the test is run. The number of different values for N is given bynumValues
. IfnumTestsPerValue
is larger than one, then the test will be run multiple times for each N, and the average time reported. Thesetup
function is called beforetimed
, and the result (of type T) is provided totimed
as the second parameter.setup
is called once before each call totimed
. -
runOnce
private static <T> void runOnce(int value, int numTestsPerValue, Function<Integer, T> setup, BiConsumer<Integer, T> timed) -
runLong
See fully parameterizedrunLong
for a description. In this abbreviated form,numTestsPerValue
is 1.setup
does nothing, therefore no value is provided totimed
. -
runLong
public static void runLong(long initialValue, int numValues, Consumer<Long> setup, Consumer<Long> timed) See fully parameterizedrunLong
for a description. In this abbreviated form,numTestsPerValue
is 1. No value is passed fromsetup
totimed
. -
runLong
public static void runLong(long initialValue, int numValues, int numTestsPerValue, Consumer<Long> setup, Consumer<Long> timed) See fully parameterizedrunLong
for a description. In this abbreviated form, no value is passed fromsetup
totimed
. -
runLong
public static <T> void runLong(long initialValue, int numValues, Function<Long, T> setup, BiConsumer<Long, T> timed) See fully parameterizedrunLong
for a description. In this abbreviated form,numTestsPerValue
is 1. -
runLong
public static <T> void runLong(long initialValue, int numValues, int numTestsPerValue, Function<Long, T> setup, Consumer<T> timed) See fully parameterizedrunLong
for a description. In this abbreviated form, the integer value is not passed totimed
. -
runLong
public static <T> void runLong(long initialValue, int numValues, Function<Long, T> setup, Consumer<T> timed) See fully parameterizedrunLong
for a description. In this abbreviated form,numTestsPerValue
is 1. The integer value is not passed totimed
. -
runLong
public static <T> void runLong(long initialValue, int numValues, int numTestsPerValue, Function<Long, T> setup, BiConsumer<Long, T> timed) Run the functiontimed
with increasing large values for the first integer parameter (N). Running time is reported to the console. Initial value of N is given byinitialValue
. N doubles each time the test is runLong. The number of different values for N is given bynumValues
. IfnumTestsPerValue
is larger than one, then the test will be runLong multiple times for each N, and the average time reported. Thesetup
function is called beforetimed
, and the result (of type T) is provided totimed
as the second parameter.setup
is called once before each call totimed
. -
runOnce
private static <T> void runOnce(long value, int numTestsPerValue, Function<Long, T> setup, BiConsumer<Long, T> timed)
-