Loading apct-tests/perftests/core/src/android/libcore/AdditionPerfTest.java +11 −11 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ package android.libcore; import android.perftests.utils.BenchmarkState; import android.perftests.utils.PerfStatusReporter; import androidx.benchmark.BenchmarkState; import androidx.benchmark.junit4.BenchmarkRule; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; Loading @@ -34,11 +34,11 @@ import org.junit.runner.RunWith; public class AdditionPerfTest { @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); @Test public void timeAddConstantToLocalInt() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); int result = 0; while (state.keepRunning()) { result += 123; Loading @@ -46,7 +46,7 @@ public class AdditionPerfTest { } @Test public void timeAddTwoLocalInts() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); int result = 0; int constant = 123; while (state.keepRunning()) { Loading @@ -55,7 +55,7 @@ public class AdditionPerfTest { } @Test public void timeAddConstantToLocalLong() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); long result = 0; while (state.keepRunning()) { result += 123L; Loading @@ -63,7 +63,7 @@ public class AdditionPerfTest { } @Test public void timeAddTwoLocalLongs() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); long result = 0; long constant = 123L; while (state.keepRunning()) { Loading @@ -72,7 +72,7 @@ public class AdditionPerfTest { } @Test public void timeAddConstantToLocalFloat() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); float result = 0.0f; while (state.keepRunning()) { result += 123.0f; Loading @@ -80,7 +80,7 @@ public class AdditionPerfTest { } @Test public void timeAddTwoLocalFloats() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); float result = 0.0f; float constant = 123.0f; while (state.keepRunning()) { Loading @@ -89,7 +89,7 @@ public class AdditionPerfTest { } @Test public void timeAddConstantToLocalDouble() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); double result = 0.0; while (state.keepRunning()) { result += 123.0; Loading @@ -97,7 +97,7 @@ public class AdditionPerfTest { } @Test public void timeAddTwoLocalDoubles() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); double result = 0.0; double constant = 123.0; while (state.keepRunning()) { Loading apct-tests/perftests/core/src/android/libcore/ArrayCopyPerfTest.java +7 −7 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ package android.libcore; import android.perftests.utils.BenchmarkState; import android.perftests.utils.PerfStatusReporter; import androidx.benchmark.BenchmarkState; import androidx.benchmark.junit4.BenchmarkRule; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; Loading @@ -33,11 +33,11 @@ import java.util.Arrays; public class ArrayCopyPerfTest { @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); @Test public void timeManualArrayCopy() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); char[] src = new char[8192]; while (state.keepRunning()) { char[] dst = new char[8192]; Loading @@ -49,7 +49,7 @@ public class ArrayCopyPerfTest { @Test public void time_System_arrayCopy() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); char[] src = new char[8192]; while (state.keepRunning()) { char[] dst = new char[8192]; Loading @@ -59,7 +59,7 @@ public class ArrayCopyPerfTest { @Test public void time_Arrays_copyOf() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); char[] src = new char[8192]; while (state.keepRunning()) { char[] dst = Arrays.copyOf(src, 8192); Loading @@ -68,7 +68,7 @@ public class ArrayCopyPerfTest { @Test public void time_Arrays_copyOfRange() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); char[] src = new char[8192]; while (state.keepRunning()) { char[] dst = Arrays.copyOfRange(src, 0, 8192); Loading apct-tests/perftests/core/src/android/libcore/ArrayIterationPerfTest.java +6 −6 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ package android.libcore; import android.perftests.utils.BenchmarkState; import android.perftests.utils.PerfStatusReporter; import androidx.benchmark.BenchmarkState; import androidx.benchmark.junit4.BenchmarkRule; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; Loading @@ -38,7 +38,7 @@ public class ArrayIterationPerfTest { } @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); Foo[] mArray = new Foo[27]; { Loading @@ -46,7 +46,7 @@ public class ArrayIterationPerfTest { } @Test public void timeArrayIteration() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { int sum = 0; for (int i = 0; i < mArray.length; i++) { Loading @@ -56,7 +56,7 @@ public class ArrayIterationPerfTest { } @Test public void timeArrayIterationCached() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { int sum = 0; Foo[] localArray = mArray; Loading @@ -69,7 +69,7 @@ public class ArrayIterationPerfTest { } @Test public void timeArrayIterationForEach() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { int sum = 0; for (Foo a: mArray) { Loading apct-tests/perftests/core/src/android/libcore/ArrayListIterationPerfTest.java +5 −5 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ package android.libcore; import android.perftests.utils.BenchmarkState; import android.perftests.utils.PerfStatusReporter; import androidx.benchmark.BenchmarkState; import androidx.benchmark.junit4.BenchmarkRule; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; Loading @@ -39,7 +39,7 @@ public class ArrayListIterationPerfTest { int mSplat; } @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); ArrayList<Foo> mList = new ArrayList<Foo>(); { Loading @@ -47,7 +47,7 @@ public class ArrayListIterationPerfTest { } @Test public void timeArrayListIterationIndexed() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { int sum = 0; ArrayList<Foo> list = mList; Loading @@ -59,7 +59,7 @@ public class ArrayListIterationPerfTest { } @Test public void timeArrayListIterationForEach() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { int sum = 0; for (Foo a : mList) { Loading apct-tests/perftests/core/src/android/libcore/BigIntegerPerfTest.java +10 −9 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ package android.libcore; import android.perftests.utils.BenchmarkState; import android.perftests.utils.PerfStatusReporter; import androidx.benchmark.BenchmarkState; import androidx.benchmark.junit4.BenchmarkRule; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; Loading @@ -38,7 +38,8 @@ import java.math.BigInteger; @RunWith(AndroidJUnit4.class) @LargeTest public class BigIntegerPerfTest { @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); // A simple sum of products computation, mostly so we can check timing in the // absence of any division. Computes the sum from 1 to n of ((10^prec) << 30) + 1)^2, Loading @@ -61,7 +62,7 @@ public class BigIntegerPerfTest { // Execute the above rep times, optionally timing it. @Test public void repeatInner() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { for (int i = 10; i <= 10_000; i *= 10) { inner(100, i); Loading @@ -85,7 +86,7 @@ public class BigIntegerPerfTest { // Check results for equality, and print one, to compaare against reference. @Test public void repeatHarmonic1000() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { for (int i = 5; i <= 5_000; i *= 10) { BigInteger refRes = harmonic1000(i); Loading @@ -106,7 +107,7 @@ public class BigIntegerPerfTest { // us to time and check it for consistency as well. @Test public void repeatToString() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { for (int i = 5; i <= 5_000; i *= 10) { BigInteger refRes = harmonic1000(i); Loading Loading @@ -146,7 +147,7 @@ public class BigIntegerPerfTest { // to compare to reference. @Test public void repeatEApprox() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { for (int i = 10; i <= 10_000; i *= 10) { BigInteger refRes = eApprox(100_000, i); Loading @@ -165,7 +166,7 @@ public class BigIntegerPerfTest { // Test / time modPow() @Test public void repeatModPow() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { for (int i = 5; i <= 500; i *= 10) { BigInteger odd1 = BigInteger.TEN.pow(i / 2).add(BigInteger.ONE); Loading Loading @@ -198,7 +199,7 @@ public class BigIntegerPerfTest { // Test / time modInverse() @Test public void repeatModInverse() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { for (int i = 10; i <= 10_000; i *= 10) { BigInteger odd1 = BigInteger.TEN.pow(i / 2).add(BigInteger.ONE); Loading Loading
apct-tests/perftests/core/src/android/libcore/AdditionPerfTest.java +11 −11 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ package android.libcore; import android.perftests.utils.BenchmarkState; import android.perftests.utils.PerfStatusReporter; import androidx.benchmark.BenchmarkState; import androidx.benchmark.junit4.BenchmarkRule; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; Loading @@ -34,11 +34,11 @@ import org.junit.runner.RunWith; public class AdditionPerfTest { @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); @Test public void timeAddConstantToLocalInt() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); int result = 0; while (state.keepRunning()) { result += 123; Loading @@ -46,7 +46,7 @@ public class AdditionPerfTest { } @Test public void timeAddTwoLocalInts() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); int result = 0; int constant = 123; while (state.keepRunning()) { Loading @@ -55,7 +55,7 @@ public class AdditionPerfTest { } @Test public void timeAddConstantToLocalLong() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); long result = 0; while (state.keepRunning()) { result += 123L; Loading @@ -63,7 +63,7 @@ public class AdditionPerfTest { } @Test public void timeAddTwoLocalLongs() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); long result = 0; long constant = 123L; while (state.keepRunning()) { Loading @@ -72,7 +72,7 @@ public class AdditionPerfTest { } @Test public void timeAddConstantToLocalFloat() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); float result = 0.0f; while (state.keepRunning()) { result += 123.0f; Loading @@ -80,7 +80,7 @@ public class AdditionPerfTest { } @Test public void timeAddTwoLocalFloats() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); float result = 0.0f; float constant = 123.0f; while (state.keepRunning()) { Loading @@ -89,7 +89,7 @@ public class AdditionPerfTest { } @Test public void timeAddConstantToLocalDouble() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); double result = 0.0; while (state.keepRunning()) { result += 123.0; Loading @@ -97,7 +97,7 @@ public class AdditionPerfTest { } @Test public void timeAddTwoLocalDoubles() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); double result = 0.0; double constant = 123.0; while (state.keepRunning()) { Loading
apct-tests/perftests/core/src/android/libcore/ArrayCopyPerfTest.java +7 −7 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ package android.libcore; import android.perftests.utils.BenchmarkState; import android.perftests.utils.PerfStatusReporter; import androidx.benchmark.BenchmarkState; import androidx.benchmark.junit4.BenchmarkRule; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; Loading @@ -33,11 +33,11 @@ import java.util.Arrays; public class ArrayCopyPerfTest { @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); @Test public void timeManualArrayCopy() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); char[] src = new char[8192]; while (state.keepRunning()) { char[] dst = new char[8192]; Loading @@ -49,7 +49,7 @@ public class ArrayCopyPerfTest { @Test public void time_System_arrayCopy() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); char[] src = new char[8192]; while (state.keepRunning()) { char[] dst = new char[8192]; Loading @@ -59,7 +59,7 @@ public class ArrayCopyPerfTest { @Test public void time_Arrays_copyOf() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); char[] src = new char[8192]; while (state.keepRunning()) { char[] dst = Arrays.copyOf(src, 8192); Loading @@ -68,7 +68,7 @@ public class ArrayCopyPerfTest { @Test public void time_Arrays_copyOfRange() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); char[] src = new char[8192]; while (state.keepRunning()) { char[] dst = Arrays.copyOfRange(src, 0, 8192); Loading
apct-tests/perftests/core/src/android/libcore/ArrayIterationPerfTest.java +6 −6 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ package android.libcore; import android.perftests.utils.BenchmarkState; import android.perftests.utils.PerfStatusReporter; import androidx.benchmark.BenchmarkState; import androidx.benchmark.junit4.BenchmarkRule; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; Loading @@ -38,7 +38,7 @@ public class ArrayIterationPerfTest { } @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); Foo[] mArray = new Foo[27]; { Loading @@ -46,7 +46,7 @@ public class ArrayIterationPerfTest { } @Test public void timeArrayIteration() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { int sum = 0; for (int i = 0; i < mArray.length; i++) { Loading @@ -56,7 +56,7 @@ public class ArrayIterationPerfTest { } @Test public void timeArrayIterationCached() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { int sum = 0; Foo[] localArray = mArray; Loading @@ -69,7 +69,7 @@ public class ArrayIterationPerfTest { } @Test public void timeArrayIterationForEach() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { int sum = 0; for (Foo a: mArray) { Loading
apct-tests/perftests/core/src/android/libcore/ArrayListIterationPerfTest.java +5 −5 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ package android.libcore; import android.perftests.utils.BenchmarkState; import android.perftests.utils.PerfStatusReporter; import androidx.benchmark.BenchmarkState; import androidx.benchmark.junit4.BenchmarkRule; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; Loading @@ -39,7 +39,7 @@ public class ArrayListIterationPerfTest { int mSplat; } @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); ArrayList<Foo> mList = new ArrayList<Foo>(); { Loading @@ -47,7 +47,7 @@ public class ArrayListIterationPerfTest { } @Test public void timeArrayListIterationIndexed() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { int sum = 0; ArrayList<Foo> list = mList; Loading @@ -59,7 +59,7 @@ public class ArrayListIterationPerfTest { } @Test public void timeArrayListIterationForEach() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { int sum = 0; for (Foo a : mList) { Loading
apct-tests/perftests/core/src/android/libcore/BigIntegerPerfTest.java +10 −9 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ package android.libcore; import android.perftests.utils.BenchmarkState; import android.perftests.utils.PerfStatusReporter; import androidx.benchmark.BenchmarkState; import androidx.benchmark.junit4.BenchmarkRule; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; Loading @@ -38,7 +38,8 @@ import java.math.BigInteger; @RunWith(AndroidJUnit4.class) @LargeTest public class BigIntegerPerfTest { @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); // A simple sum of products computation, mostly so we can check timing in the // absence of any division. Computes the sum from 1 to n of ((10^prec) << 30) + 1)^2, Loading @@ -61,7 +62,7 @@ public class BigIntegerPerfTest { // Execute the above rep times, optionally timing it. @Test public void repeatInner() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { for (int i = 10; i <= 10_000; i *= 10) { inner(100, i); Loading @@ -85,7 +86,7 @@ public class BigIntegerPerfTest { // Check results for equality, and print one, to compaare against reference. @Test public void repeatHarmonic1000() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { for (int i = 5; i <= 5_000; i *= 10) { BigInteger refRes = harmonic1000(i); Loading @@ -106,7 +107,7 @@ public class BigIntegerPerfTest { // us to time and check it for consistency as well. @Test public void repeatToString() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { for (int i = 5; i <= 5_000; i *= 10) { BigInteger refRes = harmonic1000(i); Loading Loading @@ -146,7 +147,7 @@ public class BigIntegerPerfTest { // to compare to reference. @Test public void repeatEApprox() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { for (int i = 10; i <= 10_000; i *= 10) { BigInteger refRes = eApprox(100_000, i); Loading @@ -165,7 +166,7 @@ public class BigIntegerPerfTest { // Test / time modPow() @Test public void repeatModPow() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { for (int i = 5; i <= 500; i *= 10) { BigInteger odd1 = BigInteger.TEN.pow(i / 2).add(BigInteger.ONE); Loading Loading @@ -198,7 +199,7 @@ public class BigIntegerPerfTest { // Test / time modInverse() @Test public void repeatModInverse() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { for (int i = 10; i <= 10_000; i *= 10) { BigInteger odd1 = BigInteger.TEN.pow(i / 2).add(BigInteger.ONE); Loading