summaryrefslogtreecommitdiffstats
path: root/benchmarks
diff options
context:
space:
mode:
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/Android.mk47
-rw-r--r--benchmarks/src/benchmarks/DeepArrayOpsBenchmark.java148
-rw-r--r--benchmarks/src/benchmarks/ReferenceGetBenchmark.java60
-rw-r--r--benchmarks/src/benchmarks/SystemArrayCopyBenchmark.java100
-rw-r--r--benchmarks/src/benchmarks/regression/CipherInputStreamBenchmark.java85
-rw-r--r--benchmarks/src/benchmarks/regression/EqualsHashCodeBenchmark.java15
-rw-r--r--benchmarks/src/benchmarks/regression/IcuBenchmark.java2
-rw-r--r--benchmarks/src/benchmarks/regression/MathBenchmark.java341
-rw-r--r--benchmarks/src/benchmarks/regression/SSLLoopbackBenchmark.java47
-rw-r--r--benchmarks/src/benchmarks/regression/SSLSocketBenchmark.java16
-rw-r--r--benchmarks/src/benchmarks/regression/SSLSocketFactoryBenchmark.java29
-rw-r--r--benchmarks/src/benchmarks/regression/StringCaseMappingBenchmark.java12
12 files changed, 752 insertions, 150 deletions
diff --git a/benchmarks/Android.mk b/benchmarks/Android.mk
index 6902006..c0a38a0 100644
--- a/benchmarks/Android.mk
+++ b/benchmarks/Android.mk
@@ -1,32 +1,39 @@
+# -*- mode: makefile -*-
+# Copyright (C) 2013 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
LOCAL_PATH:= $(call my-dir)
-##################################################
-include $(CLEAR_VARS)
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
+ifeq ($(LIBCORE_SKIP_TESTS),)
+##################################################
+include $(CLEAR_VARS)
LOCAL_MODULE := benchmarks
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- caliper-prebuilt \
- core-tests
-
-LOCAL_JAVA_LIBRARIES := \
- bouncycastle \
- conscrypt \
- core
-
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+LOCAL_STATIC_JAVA_LIBRARIES := caliper-prebuilt core-tests
+LOCAL_NO_STANDARD_LIBRARIES := true
+LOCAL_JAVA_LIBRARIES := core-libart conscrypt core-junit bouncycastle framework
LOCAL_MODULE_TAGS := tests
-
LOCAL_MODULE_PATH := $(PRODUCT_OUT)/data/caliperperf
-
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
include $(BUILD_JAVA_LIBRARY)
##################################################
# Prebuilt Java libraries
include $(CLEAR_VARS)
-
-LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := \
- caliper-prebuilt:libs/caliper.jar
-
+LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := caliper-prebuilt:libs/caliper.jar
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
include $(BUILD_MULTI_PREBUILT)
+
+endif
diff --git a/benchmarks/src/benchmarks/DeepArrayOpsBenchmark.java b/benchmarks/src/benchmarks/DeepArrayOpsBenchmark.java
new file mode 100644
index 0000000..09b3186
--- /dev/null
+++ b/benchmarks/src/benchmarks/DeepArrayOpsBenchmark.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package benchmarks;
+
+import com.google.caliper.Param;
+import com.google.caliper.SimpleBenchmark;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
+import java.util.Arrays;
+
+public class DeepArrayOpsBenchmark extends SimpleBenchmark {
+ @Param({"1", "4", "16", "256", "2048"}) int arrayLength;
+
+ private Object[] array;
+ private Object[] array2;
+
+ private Object[] array3;
+ private Object[] array4;
+
+ protected void setUp() throws Exception {
+ array = new Object[arrayLength * 13];
+ array2 = new Object[arrayLength * 13];
+ for (int i = 0; i < arrayLength; i += 13) {
+ array[i] = new IntWrapper(i);
+ array2[i] = new IntWrapper(i);
+
+ array[i + 1] = new16ElementObjectarray();
+ array2[i + 1] = new16ElementObjectarray();
+
+ array[i + 2] = new boolean[16];
+ array2[i + 2] = new boolean[16];
+
+ array[i + 3] = new byte[16];
+ array2[i + 3] = new byte[16];
+
+ array[i + 4] = new char[16];
+ array2[i + 4] = new char[16];
+
+ array[i + 5] = new short[16];
+ array2[i + 5] = new short[16];
+
+ array[i + 6] = new float[16];
+ array2[i + 6] = new float[16];
+
+ array[i + 7] = new long[16];
+ array2[i + 7] = new long[16];
+
+ array[i + 8] = new int[16];
+ array2[i + 8] = new int[16];
+
+ array[i + 9] = new double[16];
+ array2[i + 9] = new double[16];
+
+ // Subarray types are concrete objects.
+ array[i + 10] = new16ElementArray(String.class, String.class);
+ array2[i + 10] = new16ElementArray(String.class, String.class);
+
+ array[i + 11] = new16ElementArray(Integer.class, Integer.class);
+ array2[i + 11] = new16ElementArray(Integer.class, Integer.class);
+
+ // Subarray types is an interface.
+ array[i + 12] = new16ElementArray(CharSequence.class, String.class);
+ array2[i + 12] = new16ElementArray(CharSequence.class, String.class);
+ }
+ }
+
+ public void timeDeepHashCode(int reps) {
+ for (int i = 0; i < reps; ++i) {
+ Arrays.deepHashCode(array);
+ }
+ }
+
+ public void timeEquals(int reps) {
+ for (int i = 0; i < reps; ++i) {
+ Arrays.deepEquals(array, array2);
+ }
+ }
+
+ private static final Object[] new16ElementObjectarray() {
+ Object[] array = new Object[16];
+ for (int i = 0; i < 16; ++i) {
+ array[i] = new IntWrapper(i);
+ }
+
+ return array;
+ }
+
+ @SuppressWarnings("unchecked")
+ private static final <T, V> T[] new16ElementArray(Class<T> arrayType, Class<V> type)
+ throws Exception {
+ T[] array = (T []) Array.newInstance(type, 16);
+ if (!arrayType.isAssignableFrom(type)) {
+ throw new IllegalArgumentException(arrayType + " is not assignable from " + type);
+ }
+
+ Constructor<V> constructor = type.getDeclaredConstructor(String.class);
+ for (int i = 0; i < 16; ++i) {
+ array[i] = (T) constructor.newInstance(String.valueOf(i + 1000));
+ }
+
+ return array;
+ }
+
+ /**
+ * A class that provides very basic equals() and hashCode() operations
+ * and doesn't resort to memoization tricks like {@link java.lang.Integer}.
+ *
+ * Useful for providing equal objects that aren't the same (a.equals(b) but
+ * a != b).
+ */
+ public static final class IntWrapper {
+ private final int wrapped;
+
+ public IntWrapper(int wrap) {
+ wrapped = wrap;
+ }
+
+ @Override
+ public int hashCode() {
+ return wrapped;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (!(o instanceof IntWrapper)) {
+ return false;
+ }
+
+ return ((IntWrapper) o).wrapped == this.wrapped;
+ }
+ }
+}
+
diff --git a/benchmarks/src/benchmarks/ReferenceGetBenchmark.java b/benchmarks/src/benchmarks/ReferenceGetBenchmark.java
new file mode 100644
index 0000000..80142a1
--- /dev/null
+++ b/benchmarks/src/benchmarks/ReferenceGetBenchmark.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package benchmarks;
+
+import com.google.caliper.Param;
+import com.google.caliper.SimpleBenchmark;
+
+import java.lang.ref.Reference;
+import java.lang.ref.SoftReference;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.*;
+
+public class ReferenceGetBenchmark extends SimpleBenchmark {
+ @Param boolean intrinsicDisabled;
+
+ private Object obj = "str";
+
+ protected void setUp() throws Exception {
+ Field intrinsicDisabledField = Reference.class.getDeclaredField("disableIntrinsic");
+ intrinsicDisabledField.setAccessible(true);
+ intrinsicDisabledField.setBoolean(null, intrinsicDisabled);
+ }
+
+ public void timeSoftReferenceGet(int reps) throws Exception {
+ Reference soft = new SoftReference(obj);
+ for (int i = 0; i < reps; i++) {
+ Object o = soft.get();
+ }
+ }
+
+ public void timeWeakReferenceGet(int reps) throws Exception {
+ Reference weak = new WeakReference(obj);
+ for (int i = 0; i < reps; i++) {
+ Object o = weak.get();
+ }
+ }
+
+ public void timeNonPreservedWeakReferenceGet(int reps) throws Exception {
+ Reference weak = new WeakReference(obj);
+ obj = null;
+ Runtime.getRuntime().gc();
+ for (int i = 0; i < reps; i++) {
+ Object o = weak.get();
+ }
+ }
+}
diff --git a/benchmarks/src/benchmarks/SystemArrayCopyBenchmark.java b/benchmarks/src/benchmarks/SystemArrayCopyBenchmark.java
new file mode 100644
index 0000000..5095ee1
--- /dev/null
+++ b/benchmarks/src/benchmarks/SystemArrayCopyBenchmark.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2013 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package benchmarks;
+
+import com.google.caliper.Param;
+import com.google.caliper.SimpleBenchmark;
+
+public class SystemArrayCopyBenchmark extends SimpleBenchmark {
+ @Param({"2", "4", "8", "16", "32", "64", "128", "256", "512", "1024",
+ "2048", "4096", "8192", "16384", "32768", "65536", "131072", "262144"})
+ int arrayLength;
+
+ // Provides benchmarking for different types of arrays using the arraycopy function.
+
+ public void timeSystemCharArrayCopy(int reps) {
+ final int len = arrayLength;
+ char[] src = new char[len];
+ char[] dst = new char[len];
+ for (int rep = 0; rep < reps; ++rep) {
+ System.arraycopy(src, 0, dst, 0, len);
+ }
+ }
+
+ public void timeSystemByteArrayCopy(int reps) {
+ final int len = arrayLength;
+ byte[] src = new byte[len];
+ byte[] dst = new byte[len];
+ for (int rep = 0; rep < reps; ++rep) {
+ System.arraycopy(src, 0, dst, 0, len);
+ }
+ }
+
+ public void timeSystemShortArrayCopy(int reps) {
+ final int len = arrayLength;
+ short[] src = new short[len];
+ short[] dst = new short[len];
+ for (int rep = 0; rep < reps; ++rep) {
+ System.arraycopy(src, 0, dst, 0, len);
+ }
+ }
+
+ public void timeSystemIntArrayCopy(int reps) {
+ final int len = arrayLength;
+ int[] src = new int[len];
+ int[] dst = new int[len];
+ for (int rep = 0; rep < reps; ++rep) {
+ System.arraycopy(src, 0, dst, 0, len);
+ }
+ }
+
+ public void timeSystemLongArrayCopy(int reps) {
+ final int len = arrayLength;
+ long[] src = new long[len];
+ long[] dst = new long[len];
+ for (int rep = 0; rep < reps; ++rep) {
+ System.arraycopy(src, 0, dst, 0, len);
+ }
+ }
+
+ public void timeSystemFloatArrayCopy(int reps) {
+ final int len = arrayLength;
+ float[] src = new float[len];
+ float[] dst = new float[len];
+ for (int rep = 0; rep < reps; ++rep) {
+ System.arraycopy(src, 0, dst, 0, len);
+ }
+ }
+
+ public void timeSystemDoubleArrayCopy(int reps) {
+ final int len = arrayLength;
+ double[] src = new double[len];
+ double[] dst = new double[len];
+ for (int rep = 0; rep < reps; ++rep) {
+ System.arraycopy(src, 0, dst, 0, len);
+ }
+ }
+
+ public void timeSystemBooleanArrayCopy(int reps) {
+ final int len = arrayLength;
+ boolean[] src = new boolean[len];
+ boolean[] dst = new boolean[len];
+ for (int rep = 0; rep < reps; ++rep) {
+ System.arraycopy(src, 0, dst, 0, len);
+ }
+ }
+}
diff --git a/benchmarks/src/benchmarks/regression/CipherInputStreamBenchmark.java b/benchmarks/src/benchmarks/regression/CipherInputStreamBenchmark.java
new file mode 100644
index 0000000..9dce12a
--- /dev/null
+++ b/benchmarks/src/benchmarks/regression/CipherInputStreamBenchmark.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2012 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package benchmarks.regression;
+
+import com.google.caliper.Param;
+import com.google.caliper.SimpleBenchmark;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.spec.AlgorithmParameterSpec;
+
+import javax.crypto.CipherInputStream;
+import javax.crypto.KeyGenerator;
+import javax.crypto.SecretKey;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.crypto.Cipher;
+import javax.crypto.spec.IvParameterSpec;
+
+/**
+ * CipherInputStream benchmark.
+ */
+public class CipherInputStreamBenchmark extends SimpleBenchmark {
+
+ private static final int DATA_SIZE = 1024 * 1024;
+ private static final byte[] DATA = new byte[DATA_SIZE];
+
+ private static final int IV_SIZE = 16;
+ private static final byte[] IV = new byte[IV_SIZE];
+
+ static {
+ for (int i = 0; i < DATA_SIZE; i++) {
+ DATA[i] = (byte) i;
+ }
+ for (int i = 0; i < IV_SIZE; i++) {
+ IV[i] = (byte) i;
+ }
+ }
+
+ private SecretKey key;
+
+ private byte[] output = new byte[8192];
+
+ private Cipher cipherEncrypt;
+
+ private AlgorithmParameterSpec spec;
+
+ @Override protected void setUp() throws Exception {
+ KeyGenerator generator = KeyGenerator.getInstance("AES");
+ generator.init(128);
+ key = generator.generateKey();
+
+ spec = new IvParameterSpec(IV);
+
+ cipherEncrypt = Cipher.getInstance("AES/CBC/PKCS5Padding");
+ cipherEncrypt.init(Cipher.ENCRYPT_MODE, key, spec);
+ }
+
+ public void timeEncrypt(int reps) throws Exception {
+ for (int i = 0; i < reps; ++i) {
+ cipherEncrypt.init(Cipher.ENCRYPT_MODE, key, spec);
+ InputStream is = new CipherInputStream(new ByteArrayInputStream(DATA), cipherEncrypt);
+ while (is.read(output) != -1) {
+ }
+ }
+ }
+}
diff --git a/benchmarks/src/benchmarks/regression/EqualsHashCodeBenchmark.java b/benchmarks/src/benchmarks/regression/EqualsHashCodeBenchmark.java
index a15a41a..72bb216 100644
--- a/benchmarks/src/benchmarks/regression/EqualsHashCodeBenchmark.java
+++ b/benchmarks/src/benchmarks/regression/EqualsHashCodeBenchmark.java
@@ -36,6 +36,8 @@ public final class EqualsHashCodeBenchmark extends SimpleBenchmark {
abstract Object newInstance(String text) throws Exception;
}
+ private static final String QUERY = "%E0%AE%A8%E0%AE%BE%E0%AE%AE%E0%AF%8D+%E0%AE%AE%E0%AF%81%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%BF%E0%AE%AF%E0%AE%AE%E0%AE%BE%E0%AE%A9%2C+%E0%AE%9A%E0%AF%81%E0%AE%B5%E0%AE%BE%E0%AE%B0%E0%AE%B8%E0%AF%8D%E0%AE%AF%E0%AE%AE%E0%AE%BE%E0%AE%A9+%E0%AE%87%E0%AE%B0%E0%AF%81%E0%AE%AA%E0%AF%8D%E0%AE%AA%E0%AF%87%E0%AE%BE%E0%AE%AE%E0%AF%8D%2C+%E0%AE%86%E0%AE%A9%E0%AE%BE%E0%AE%B2%E0%AF%8D+%E0%AE%9A%E0%AE%BF%E0%AE%B2+%E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%88+%E0%AE%A8%E0%AF%80%E0%AE%99%E0%AF%8D%E0%AE%95%E0%AE%B3%E0%AF%8D+%E0%AE%AA%E0%AE%B0%E0%AE%BF%E0%AE%A8%E0%AF%8D%E0%AE%A4%E0%AF%81%E0%AE%B0%E0%AF%88%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%BF%E0%AE%B1%E0%AF%87%E0%AE%BE%E0%AE%AE%E0%AF%8D+%E0%AE%AE%E0%AF%86%E0%AE%A9%E0%AF%8D%E0%AE%AE%E0%AF%88%E0%AE%AF%E0%AE%BE%E0%AE%95+%E0%AE%AE%E0%AE%BE%E0%AE%B1%E0%AF%81%E0%AE%AE%E0%AF%8D";
+
@Param Type type;
Object a1;
@@ -43,11 +45,18 @@ public final class EqualsHashCodeBenchmark extends SimpleBenchmark {
Object b1;
Object b2;
+ Object c1;
+ Object c2;
+
@Override protected void setUp() throws Exception {
a1 = type.newInstance("https://mail.google.com/mail/u/0/?shva=1#inbox");
a2 = type.newInstance("https://mail.google.com/mail/u/0/?shva=1#inbox");
b1 = type.newInstance("http://developer.android.com/reference/java/net/URI.html");
b2 = type.newInstance("http://developer.android.com/reference/java/net/URI.html");
+
+ c1 = type.newInstance("http://developer.android.com/query?q=" + QUERY);
+ // Replace the very last char.
+ c2 = type.newInstance("http://developer.android.com/query?q=" + QUERY.substring(0, QUERY.length() - 3) + "%AF");
}
public void timeEquals(int reps) {
@@ -64,4 +73,10 @@ public final class EqualsHashCodeBenchmark extends SimpleBenchmark {
b1.hashCode();
}
}
+
+ public void timeEqualsWithHeavilyEscapedComponent(int reps) {
+ for (int i = 0; i < reps; ++i) {
+ c1.equals(c2);
+ }
+ }
}
diff --git a/benchmarks/src/benchmarks/regression/IcuBenchmark.java b/benchmarks/src/benchmarks/regression/IcuBenchmark.java
index ee8270a..2aed36b 100644
--- a/benchmarks/src/benchmarks/regression/IcuBenchmark.java
+++ b/benchmarks/src/benchmarks/regression/IcuBenchmark.java
@@ -26,7 +26,7 @@ import libcore.icu.ICU;
public class IcuBenchmark extends SimpleBenchmark {
public void time_getBestDateTimePattern(int reps) throws Exception {
for (int rep = 0; rep < reps; ++rep) {
- ICU.getBestDateTimePattern("dEEEMMM", "US");
+ ICU.getBestDateTimePattern("dEEEMMM", new Locale("en", "US"));
}
}
}
diff --git a/benchmarks/src/benchmarks/regression/MathBenchmark.java b/benchmarks/src/benchmarks/regression/MathBenchmark.java
index 25a871d..19b2162 100644
--- a/benchmarks/src/benchmarks/regression/MathBenchmark.java
+++ b/benchmarks/src/benchmarks/regression/MathBenchmark.java
@@ -30,339 +30,456 @@ public class MathBenchmark extends SimpleBenchmark {
private final int i = 1;
private final long l = 1L;
- public void timeAbsD(int reps) {
+ // NOTE: To avoid the benchmarked function from being optimized away, we store the result
+ // and use it as the benchmark's return value. This is good enough for now but may not be in
+ // the future, a smart compiler could determine that the result value will depend on whether
+ // we get into the loop or not and turn the whole loop into an if statement.
+
+ public double timeAbsD(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.abs(d);
+ result = Math.abs(d);
}
+ return result;
}
- public void timeAbsF(int reps) {
+ public float timeAbsF(int reps) {
+ float result = f;
for (int rep = 0; rep < reps; ++rep) {
- Math.abs(f);
+ result = Math.abs(f);
}
+ return result;
}
- public void timeAbsI(int reps) {
+ public int timeAbsI(int reps) {
+ int result = i;
for (int rep = 0; rep < reps; ++rep) {
- Math.abs(i);
+ result = Math.abs(i);
}
+ return result;
}
- public void timeAbsL(int reps) {
+ public long timeAbsL(int reps) {
+ long result = l;
for (int rep = 0; rep < reps; ++rep) {
- Math.abs(l);
+ result = Math.abs(l);
}
+ return result;
}
- public void timeAcos(int reps) {
+ public double timeAcos(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.acos(d);
+ result = Math.acos(d);
}
+ return result;
}
- public void timeAsin(int reps) {
+ public double timeAsin(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.asin(d);
+ result = Math.asin(d);
}
+ return result;
}
- public void timeAtan(int reps) {
+ public double timeAtan(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.atan(d);
+ result = Math.atan(d);
}
+ return result;
}
- public void timeAtan2(int reps) {
+ public double timeAtan2(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.atan2(3, 4);
+ result = Math.atan2(3, 4);
}
+ return result;
}
- public void timeCbrt(int reps) {
+ public double timeCbrt(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.cbrt(d);
+ result = Math.cbrt(d);
}
+ return result;
}
- public void timeCeil(int reps) {
+ public double timeCeil(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.ceil(d);
+ result = Math.ceil(d);
}
+ return result;
}
- public void timeCopySignD(int reps) {
+ public double timeCopySignD(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.copySign(d, d);
+ result = Math.copySign(d, d);
}
+ return result;
}
- public void timeCopySignF(int reps) {
+ public float timeCopySignF(int reps) {
+ float result = f;
for (int rep = 0; rep < reps; ++rep) {
- Math.copySign(f, f);
+ result = Math.copySign(f, f);
}
+ return result;
}
- public void timeCopySignD_strict(int reps) {
+ public double timeCopySignD_strict(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- StrictMath.copySign(d, d);
+ result = StrictMath.copySign(d, d);
}
+ return result;
}
- public void timeCopySignF_strict(int reps) {
+ public float timeCopySignF_strict(int reps) {
+ float result = f;
for (int rep = 0; rep < reps; ++rep) {
- StrictMath.copySign(f, f);
+ result = StrictMath.copySign(f, f);
}
+ return result;
}
- public void timeCos(int reps) {
+ public double timeCos(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.cos(d);
+ result = Math.cos(d);
}
+ return result;
}
- public void timeCosh(int reps) {
+ public double timeCosh(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.cosh(d);
+ result = Math.cosh(d);
}
+ return result;
}
- public void timeExp(int reps) {
+ public double timeExp(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.exp(d);
+ result = Math.exp(d);
}
+ return result;
}
- public void timeExpm1(int reps) {
+ public double timeExpm1(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.expm1(d);
+ result = Math.expm1(d);
}
+ return result;
}
- public void timeFloor(int reps) {
+ public double timeFloor(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.floor(d);
+ result = Math.floor(d);
}
+ return result;
}
- public void timeGetExponentD(int reps) {
+ public int timeGetExponentD(int reps) {
+ int result = i;
for (int rep = 0; rep < reps; ++rep) {
- Math.getExponent(d);
+ result = Math.getExponent(d);
}
+ return result;
}
- public void timeGetExponentF(int reps) {
+ public int timeGetExponentF(int reps) {
+ int result = i;
for (int rep = 0; rep < reps; ++rep) {
- Math.getExponent(f);
+ result = Math.getExponent(f);
}
+ return result;
}
- public void timeHypot(int reps) {
+ public double timeHypot(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.hypot(d, d);
+ result = Math.hypot(d, d);
}
+ return result;
}
- public void timeIEEEremainder(int reps) {
+ public double timeIEEEremainder(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.IEEEremainder(d, d);
+ result = Math.IEEEremainder(d, d);
}
+ return result;
}
- public void timeLog(int reps) {
+ public double timeLog(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.log(d);
+ result = Math.log(d);
}
+ return result;
}
- public void timeLog10(int reps) {
+ public double timeLog10(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.log10(d);
+ result = Math.log10(d);
}
+ return result;
}
- public void timeLog1p(int reps) {
+ public double timeLog1p(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.log1p(d);
+ result = Math.log1p(d);
}
+ return result;
}
- public void timeMaxD(int reps) {
+ public double timeMaxD(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.max(d, d);
+ result = Math.max(d, d);
}
+ return result;
}
- public void timeMaxF(int reps) {
+ public float timeMaxF(int reps) {
+ float result = f;
for (int rep = 0; rep < reps; ++rep) {
- Math.max(f, f);
+ result = Math.max(f, f);
}
+ return result;
}
- public void timeMaxI(int reps) {
+ public int timeMaxI(int reps) {
+ int result = i;
for (int rep = 0; rep < reps; ++rep) {
- Math.max(i, i);
+ result = Math.max(i, i);
}
+ return result;
}
- public void timeMaxL(int reps) {
+ public long timeMaxL(int reps) {
+ long result = l;
for (int rep = 0; rep < reps; ++rep) {
- Math.max(l, l);
+ result = Math.max(l, l);
}
+ return result;
}
- public void timeMinD(int reps) {
+ public double timeMinD(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.min(d, d);
+ result = Math.min(d, d);
}
+ return result;
}
- public void timeMinF(int reps) {
+ public float timeMinF(int reps) {
+ float result = f;
for (int rep = 0; rep < reps; ++rep) {
- Math.min(f, f);
+ result = Math.min(f, f);
}
+ return result;
}
- public void timeMinI(int reps) {
+ public int timeMinI(int reps) {
+ int result = i;
for (int rep = 0; rep < reps; ++rep) {
- Math.min(i, i);
+ result = Math.min(i, i);
}
+ return result;
}
- public void timeMinL(int reps) {
+ public long timeMinL(int reps) {
+ long result = l;
for (int rep = 0; rep < reps; ++rep) {
- Math.min(l, l);
+ result = Math.min(l, l);
}
+ return result;
}
- public void timeNextAfterD(int reps) {
+ public double timeNextAfterD(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.nextAfter(d, d);
+ result = Math.nextAfter(d, d);
}
+ return result;
}
- public void timeNextAfterF(int reps) {
+ public float timeNextAfterF(int reps) {
+ float result = f;
for (int rep = 0; rep < reps; ++rep) {
- Math.nextAfter(f, f);
+ result = Math.nextAfter(f, f);
}
+ return result;
}
- public void timeNextUpD(int reps) {
+ public double timeNextUpD(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.nextUp(d);
+ result = Math.nextUp(d);
}
+ return result;
}
- public void timeNextUpF(int reps) {
+ public float timeNextUpF(int reps) {
+ float result = f;
for (int rep = 0; rep < reps; ++rep) {
- Math.nextUp(f);
+ result = Math.nextUp(f);
}
+ return result;
}
- public void timePow(int reps) {
+ public double timePow(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.pow(d, d);
+ result = Math.pow(d, d);
}
+ return result;
}
- public void timeRandom(int reps) {
+ public double timeRandom(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.random();
+ result = Math.random();
}
+ return result;
}
- public void timeRint(int reps) {
+ public double timeRint(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.rint(d);
+ result = Math.rint(d);
}
+ return result;
}
- public void timeRoundD(int reps) {
+ public long timeRoundD(int reps) {
+ long result = l;
for (int rep = 0; rep < reps; ++rep) {
- Math.round(d);
+ result = Math.round(d);
}
+ return result;
}
- public void timeRoundF(int reps) {
+ public int timeRoundF(int reps) {
+ int result = i;
for (int rep = 0; rep < reps; ++rep) {
- Math.round(f);
+ result = Math.round(f);
}
+ return result;
}
- public void timeScalbD(int reps) {
+ public double timeScalbD(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.scalb(d, 5);
+ result = Math.scalb(d, 5);
}
+ return result;
}
- public void timeScalbF(int reps) {
+ public float timeScalbF(int reps) {
+ float result = f;
for (int rep = 0; rep < reps; ++rep) {
- Math.scalb(f, 5);
+ result = Math.scalb(f, 5);
}
+ return result;
}
- public void timeSignumD(int reps) {
+ public double timeSignumD(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.signum(d);
+ result = Math.signum(d);
}
+ return result;
}
- public void timeSignumF(int reps) {
+ public float timeSignumF(int reps) {
+ float result = f;
for (int rep = 0; rep < reps; ++rep) {
- Math.signum(f);
+ result = Math.signum(f);
}
+ return result;
}
- public void timeSin(int reps) {
+ public double timeSin(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.sin(d);
+ result = Math.sin(d);
}
+ return result;
}
- public void timeSinh(int reps) {
+ public double timeSinh(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.sinh(d);
+ result = Math.sinh(d);
}
+ return result;
}
- public void timeSqrt(int reps) {
+ public double timeSqrt(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.sqrt(d);
+ result = Math.sqrt(d);
}
+ return result;
}
- public void timeTan(int reps) {
+ public double timeTan(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.tan(d);
+ result = Math.tan(d);
}
+ return result;
}
- public void timeTanh(int reps) {
+ public double timeTanh(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.tanh(d);
+ result = Math.tanh(d);
}
+ return result;
}
- public void timeToDegrees(int reps) {
+ public double timeToDegrees(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.toDegrees(d);
+ result = Math.toDegrees(d);
}
+ return result;
}
- public void timeToRadians(int reps) {
+ public double timeToRadians(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.toRadians(d);
+ result = Math.toRadians(d);
}
+ return result;
}
- public void timeUlpD(int reps) {
+ public double timeUlpD(int reps) {
+ double result = d;
for (int rep = 0; rep < reps; ++rep) {
- Math.ulp(d);
+ result = Math.ulp(d);
}
+ return result;
}
- public void timeUlpF(int reps) {
+ public float timeUlpF(int reps) {
+ float result = f;
for (int rep = 0; rep < reps; ++rep) {
- Math.ulp(f);
+ result = Math.ulp(f);
}
+ return result;
}
}
diff --git a/benchmarks/src/benchmarks/regression/SSLLoopbackBenchmark.java b/benchmarks/src/benchmarks/regression/SSLLoopbackBenchmark.java
new file mode 100644
index 0000000..0d9a792
--- /dev/null
+++ b/benchmarks/src/benchmarks/regression/SSLLoopbackBenchmark.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package benchmarks.regression;
+
+import com.google.caliper.SimpleBenchmark;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetAddress;
+import java.net.Socket;
+import java.net.URL;
+import javax.net.SocketFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLServerSocketFactory;
+import javax.net.ssl.SSLSocket;
+
+import libcore.java.security.TestKeyStore;
+import libcore.javax.net.ssl.TestSSLContext;
+import libcore.javax.net.ssl.TestSSLSocketPair;
+
+public class SSLLoopbackBenchmark extends SimpleBenchmark {
+
+ public void time(int reps) throws Exception {
+ for (int i = 0; i < reps; ++i) {
+ TestSSLContext context = TestSSLContext.create(
+ TestKeyStore.getClient(), TestKeyStore.getServer());
+ SSLSocket[] sockets = TestSSLSocketPair.connect(context, null, null);
+ context.close();
+ sockets[0].close();
+ sockets[1].close();
+ }
+ }
+}
diff --git a/benchmarks/src/benchmarks/regression/SSLSocketBenchmark.java b/benchmarks/src/benchmarks/regression/SSLSocketBenchmark.java
index fd72a79..5be890e 100644
--- a/benchmarks/src/benchmarks/regression/SSLSocketBenchmark.java
+++ b/benchmarks/src/benchmarks/regression/SSLSocketBenchmark.java
@@ -69,24 +69,10 @@ public class SSLSocketBenchmark extends SimpleBenchmark {
}
}
- @Param private Implementation implementation;
-
- public enum Implementation { OPENSSL, HARMONY };
-
private SocketFactory sf;
@Override protected void setUp() throws Exception {
- SSLContext sslContext;
- switch (implementation) {
- case OPENSSL:
- sslContext = SSLContext.getInstance("SSL", "AndroidOpenSSL");
- break;
- case HARMONY:
- sslContext = SSLContext.getInstance("SSL", "HarmonyJSSE");
- break;
- default:
- throw new RuntimeException(implementation.toString());
- }
+ SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(null, null, null);
this.sf = sslContext.getSocketFactory();
}
diff --git a/benchmarks/src/benchmarks/regression/SSLSocketFactoryBenchmark.java b/benchmarks/src/benchmarks/regression/SSLSocketFactoryBenchmark.java
new file mode 100644
index 0000000..d0448d6
--- /dev/null
+++ b/benchmarks/src/benchmarks/regression/SSLSocketFactoryBenchmark.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package benchmarks.regression;
+
+import com.google.caliper.Param;
+import com.google.caliper.SimpleBenchmark;
+import javax.net.ssl.SSLSocketFactory;
+
+public class SSLSocketFactoryBenchmark extends SimpleBenchmark {
+ public void time(int reps) throws Exception {
+ for (int i = 0; i < reps; ++i) {
+ SSLSocketFactory.getDefault();
+ }
+ }
+}
diff --git a/benchmarks/src/benchmarks/regression/StringCaseMappingBenchmark.java b/benchmarks/src/benchmarks/regression/StringCaseMappingBenchmark.java
index ba5b59e..ae6b6b6 100644
--- a/benchmarks/src/benchmarks/regression/StringCaseMappingBenchmark.java
+++ b/benchmarks/src/benchmarks/regression/StringCaseMappingBenchmark.java
@@ -78,6 +78,14 @@ public class StringCaseMappingBenchmark extends SimpleBenchmark {
}
}
+ // toUpperCase for Greek is an extra-hard case that uses icu4c's Transliterator.
+ public void timeToUpperCase_el_GR(int reps) {
+ Locale el_GR = new Locale("el", "GR");
+ for (int i = 0; i < reps; ++i) {
+ s.value.toUpperCase(el_GR);
+ }
+ }
+
public void timeToLowerCase_US(int reps) {
for (int i = 0; i < reps; ++i) {
s.value.toUpperCase(Locale.US);
@@ -98,13 +106,13 @@ public class StringCaseMappingBenchmark extends SimpleBenchmark {
public void timeToUpperCase_ICU(int reps) {
for (int i = 0; i < reps; ++i) {
- libcore.icu.ICU.toUpperCase(s.value, Locale.US.toString());
+ libcore.icu.ICU.toUpperCase(s.value, Locale.US);
}
}
public void timeToLowerCase_ICU(int reps) {
for (int i = 0; i < reps; ++i) {
- libcore.icu.ICU.toLowerCase(s.value, Locale.US.toString());
+ libcore.icu.ICU.toLowerCase(s.value, Locale.US);
}
}