summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Gillin <peteg@google.com>2018-04-23 08:28:39 -0700
committerandroid-build-merger <android-build-merger@google.com>2018-04-23 08:28:39 -0700
commit80ac91a113079bc4b6784cf4b6449230c85490ea (patch)
tree1e4c749ae403806126d125fce1de2c77ef212590
parent1c45c4b2d2f027b4f531470b80d9d011c9d33985 (diff)
parent1dd66948a4545f26bd5c66d34fdc7f86f6057e04 (diff)
Merge "Fix DeepArrayOpsBenchmark."
am: 1dd66948a4 Change-Id: I45bb7c77698818c42674d032c74cdeffb6b6fde6
-rw-r--r--benchmarks/src/benchmarks/DeepArrayOpsBenchmark.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/benchmarks/src/benchmarks/DeepArrayOpsBenchmark.java b/benchmarks/src/benchmarks/DeepArrayOpsBenchmark.java
index 142906211b..624d8234bd 100644
--- a/benchmarks/src/benchmarks/DeepArrayOpsBenchmark.java
+++ b/benchmarks/src/benchmarks/DeepArrayOpsBenchmark.java
@@ -16,21 +16,20 @@
package benchmarks;
+import com.google.caliper.BeforeExperiment;
+import com.google.caliper.Benchmark;
import com.google.caliper.Param;
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.util.Arrays;
public class DeepArrayOpsBenchmark {
- @Param({"1", "4", "16", "256", "2048"}) int arrayLength;
+ @Param({"0001", "0004", "0016", "0256", "2048"}) int arrayLength;
private Object[] array;
private Object[] array2;
- private Object[] array3;
- private Object[] array4;
-
- protected void setUp() throws Exception {
+ @BeforeExperiment public void setUp() throws Exception {
array = new Object[arrayLength * 13];
array2 = new Object[arrayLength * 13];
for (int i = 0; i < arrayLength; i += 13) {
@@ -77,13 +76,13 @@ public class DeepArrayOpsBenchmark {
}
}
- public void timeDeepHashCode(int reps) {
+ @Benchmark public void deepHashCode(int reps) {
for (int i = 0; i < reps; ++i) {
Arrays.deepHashCode(array);
}
}
- public void timeEquals(int reps) {
+ @Benchmark public void deepEquals(int reps) {
for (int i = 0; i < reps; ++i) {
Arrays.deepEquals(array, array2);
}