examples
Class CopyArrayBenchmark
java.lang.Object
com.google.caliper.api.Benchmark
com.google.caliper.SimpleBenchmark
examples.CopyArrayBenchmark
- All Implemented Interfaces:
- com.google.caliper.Benchmark
public class CopyArrayBenchmark
- extends com.google.caliper.SimpleBenchmark
Tests each of the three (non-manual) ways to copy an array, for all nine array types.
For a recent (2010) build of OpenJDK on linux, this benchmark confirms these facts:
- The three methods of copying have indistinguishable performance for all nine types.
- As array sizes get large, the runtime is indeed proportional to the size of the array in
memory (boolean arrays count as byte arrays!).
| Methods inherited from class com.google.caliper.SimpleBenchmark |
bytesToUnits, createBenchmark, getInstanceUnitNames, getMemoryUnitNames, getTimeUnitNames, instancesToUnits, nanosToUnits, normalizeScenario, parameterNames, parameterValues, tearDown |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CopyArrayBenchmark
public CopyArrayBenchmark()
setUp
protected void setUp()
- Overrides:
setUp in class com.google.caliper.SimpleBenchmark
timeObjects
public int timeObjects(int reps)
timeBooleans
public int timeBooleans(int reps)
timeBytes
public int timeBytes(int reps)
timeChars
public int timeChars(int reps)
timeDoubles
public int timeDoubles(int reps)
timeFloats
public int timeFloats(int reps)
timeInts
public int timeInts(int reps)
timeLongs
public int timeLongs(int reps)
timeShorts
public int timeShorts(int reps)
main
public static void main(String[] args)
Copyright © 2009-2011 Google, Inc.. All Rights Reserved.