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