Package stdlib

Class DoublingTest

java.lang.Object
stdlib.DoublingTest

public class DoublingTest extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static long
     
    private static double
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addOps(int count)
    During a doubling test, the provided code may call incOps and/or addOps.
    static void
    During a doubling test, the provided code may call incOps and/or addOps.
    static void
    run(int initialValue, int numValues, int numTestsPerValue, Consumer<Integer> setup, Consumer<Integer> timed)
    See fully parameterized run for a description.
    static <T> void
    run(int initialValue, int numValues, int numTestsPerValue, Function<Integer,T> setup, BiConsumer<Integer,T> timed)
    Run the function timed 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 parameterized run for a description.
    static void
    run(int initialValue, int numValues, Consumer<Integer> timed)
    See fully parameterized run for a description.
    static void
    run(int initialValue, int numValues, Consumer<Integer> setup, Consumer<Integer> timed)
    See fully parameterized run for a description.
    static <T> void
    run(int initialValue, int numValues, Function<Integer,T> setup, BiConsumer<Integer,T> timed)
    See fully parameterized run for a description.
    static <T> void
    run(int initialValue, int numValues, Function<Integer,T> setup, Consumer<T> timed)
    See fully parameterized run for a description.
    static void
    runLong(long initialValue, int numValues, int numTestsPerValue, Consumer<Long> setup, Consumer<Long> timed)
    See fully parameterized runLong for a description.
    static <T> void
    runLong(long initialValue, int numValues, int numTestsPerValue, Function<Long,T> setup, BiConsumer<Long,T> timed)
    Run the function timed 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 parameterized runLong for a description.
    static void
    runLong(long initialValue, int numValues, Consumer<Long> timed)
    See fully parameterized runLong for a description.
    static void
    runLong(long initialValue, int numValues, Consumer<Long> setup, Consumer<Long> timed)
    See fully parameterized runLong for a description.
    static <T> void
    runLong(long initialValue, int numValues, Function<Long,T> setup, BiConsumer<Long,T> timed)
    See fully parameterized runLong for a description.
    static <T> void
    runLong(long initialValue, int numValues, Function<Long,T> setup, Consumer<T> timed)
    See fully parameterized runLong 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)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • time

      private static double time
    • ops

      private static long ops
  • Constructor Details

  • Method Details

    • incOps

      public static void incOps()
      During a doubling test, the provided code may call incOps and/or addOps. If either is called, then the number of operations so recorded will be reported by run.
    • addOps

      public static void addOps(int count)
      During a doubling test, the provided code may call incOps and/or addOps. If either is called, then the number of operations so recorded will be reported by run.
    • run

      public static void run(int initialValue, int numValues, Consumer<Integer> timed)
      See fully parameterized run for a description. In this abbreviated form, numTestsPerValue is 1. setup does nothing, therefore no value is provided to timed.
    • run

      public static void run(int initialValue, int numValues, Consumer<Integer> setup, Consumer<Integer> timed)
      See fully parameterized run for a description. In this abbreviated form, numTestsPerValue is 1. No value is passed from setup to timed.
    • run

      public static void run(int initialValue, int numValues, int numTestsPerValue, Consumer<Integer> setup, Consumer<Integer> timed)
      See fully parameterized run for a description. In this abbreviated form, no value is passed from setup to timed.
    • run

      public static <T> void run(int initialValue, int numValues, Function<Integer,T> setup, BiConsumer<Integer,T> timed)
      See fully parameterized run 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 parameterized run for a description. In this abbreviated form, the integer value is not passed to timed.
    • run

      public static <T> void run(int initialValue, int numValues, Function<Integer,T> setup, Consumer<T> timed)
      See fully parameterized run for a description. In this abbreviated form, numTestsPerValue is 1. The integer value is not passed to timed.
    • run

      public static <T> void run(int initialValue, int numValues, int numTestsPerValue, Function<Integer,T> setup, BiConsumer<Integer,T> timed)
      Run the function timed with increasing large values for the first integer parameter (N). Running time is reported to the console. Initial value of N is given by initialValue. N doubles each time the test is run. The number of different values for N is given by numValues. If numTestsPerValue is larger than one, then the test will be run multiple times for each N, and the average time reported. The setup function is called before timed, and the result (of type T) is provided to timed as the second parameter. setup is called once before each call to timed.
    • runOnce

      private static <T> void runOnce(int value, int numTestsPerValue, Function<Integer,T> setup, BiConsumer<Integer,T> timed)
    • runLong

      public static void runLong(long initialValue, int numValues, Consumer<Long> timed)
      See fully parameterized runLong for a description. In this abbreviated form, numTestsPerValue is 1. setup does nothing, therefore no value is provided to timed.
    • runLong

      public static void runLong(long initialValue, int numValues, Consumer<Long> setup, Consumer<Long> timed)
      See fully parameterized runLong for a description. In this abbreviated form, numTestsPerValue is 1. No value is passed from setup to timed.
    • runLong

      public static void runLong(long initialValue, int numValues, int numTestsPerValue, Consumer<Long> setup, Consumer<Long> timed)
      See fully parameterized runLong for a description. In this abbreviated form, no value is passed from setup to timed.
    • runLong

      public static <T> void runLong(long initialValue, int numValues, Function<Long,T> setup, BiConsumer<Long,T> timed)
      See fully parameterized runLong 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 parameterized runLong for a description. In this abbreviated form, the integer value is not passed to timed.
    • runLong

      public static <T> void runLong(long initialValue, int numValues, Function<Long,T> setup, Consumer<T> timed)
      See fully parameterized runLong for a description. In this abbreviated form, numTestsPerValue is 1. The integer value is not passed to timed.
    • runLong

      public static <T> void runLong(long initialValue, int numValues, int numTestsPerValue, Function<Long,T> setup, BiConsumer<Long,T> timed)
      Run the function timed with increasing large values for the first integer parameter (N). Running time is reported to the console. Initial value of N is given by initialValue. N doubles each time the test is runLong. The number of different values for N is given by numValues. If numTestsPerValue is larger than one, then the test will be runLong multiple times for each N, and the average time reported. The setup function is called before timed, and the result (of type T) is provided to timed as the second parameter. setup is called once before each call to timed.
    • runOnce

      private static <T> void runOnce(long value, int numTestsPerValue, Function<Long,T> setup, BiConsumer<Long,T> timed)