@@ -0,0 +1,2535 @@
+/*%0A * Zorbage: an algebraic data hierarchy for use in numeric processing.%0A *%0A * Copyright (c) 2016-2021 Barry DeZonia All rights reserved.%0A * %0A * Redistribution and use in source and binary forms, with or without modification,%0A * are permitted provided that the following conditions are met:%0A * %0A * Redistributions of source code must retain the above copyright notice, this list%0A * of conditions and the following disclaimer.%0A * %0A * Redistributions in binary form must reproduce the above copyright notice, this%0A * list of conditions and the following disclaimer in the documentation and/or other%0A * materials provided with the distribution.%0A * %0A * Neither the name of the %3Ccopyright holder%3E nor the names of its contributors may%0A * be used to endorse or promote products derived from this software without specific%0A * prior written permission.%0A * %0A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS %22AS IS%22 AND%0A * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED%0A * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.%0A * IN NO EVENT SHALL %3CCOPYRIGHT HOLDER%3E BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,%0A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,%0A * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR%0A * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN%0A * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN%0A * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH%0A * DAMAGE.%0A */%0Apackage nom.bdezonia.zorbage.algorithm;%0A%0Aimport nom.bdezonia.zorbage.function.Function0;%0Aimport nom.bdezonia.zorbage.procedure.Procedure1;%0A%0A/**%0A * %0A * @author Barry DeZonia%0A *%0A */%0Apublic class Benchmark %7B%0A%0A%09/**%0A%09 * Measure the time for a process to run.%0A%09 * @param %3CX%3E%0A%09 * @param initializer The setup code for the timing suite.%0A%09 * @param procedure The %22chunk of code' that is being timed.%0A%09 * @return The total milleseconds it takes to run the chunk of code.%0A%09 */%0A%09public static %3CX%3E%0A%09%09long measureTime(Function0%3CX%3E initializer, Procedure1%3CX%3E procedure)%0A%09%7B%0A%09%09// allocate data%0A%09%09%0A%09%09X data = initializer.call();%0A%09%09%0A%09%09// warm up the cache%0A%09%09%0A%09%09for (int i = 0; i %3C 5; i++) %7B%0A%09%09%09procedure.call(data);%0A%09%09%7D%0A%09%09%0A%09%09// now time one run%0A%09%09%0A%09%09long start = System.currentTimeMillis();%0A%09%09%0A%09%09procedure.call(data);%0A%09%09%0A%09%09long end = System.currentTimeMillis();%0A%09%09%0A%09%09// and return millisecond timing%0A%09%09%0A%09%09return (end - start);%0A%09%7D%0A%7D%0A

Add a benchmarking class