Android Developers
developer.android.com › app quality › microbenchmark
Microbenchmark | App quality | Android Developers
The Jetpack Microbenchmark library lets you benchmark your Android native code—Kotlin or Java—from within Android Studio.
GitHub
github.com › android › performance-samples
GitHub - android/performance-samples: Samples to show APIs and best practices in Performance on Android
A collection of samples using the performance libraries. You can learn more about Android Performance at https://d.android.com/performance.
Starred by 1.4K users
Forked by 234 users
Languages Kotlin 92.7% | TypeScript 7.0% | Shell 0.3%
Android Developers
developer.android.com › app quality › write a macrobenchmark
Write a Macrobenchmark | App quality | Android Developers
The library outputs benchmarking results to both the Android Studio console and a JSON file with more detail.
Android Developers
developer.android.com › app quality › benchmark your app
Benchmark your app | App quality | Android Developers
Android offers two benchmarking libraries and approaches for analyzing and testing different kinds of situations in your app: Macrobenchmark and Microbenchmark.
Android Developers
developer.android.com › get started › jetpack › benchmark
Benchmark | Jetpack | Android Developers
This library now targets Kotlin 2.0 language level and requires KGP 2.0.0 or newer. (Idb6b5) ... androidx.benchmark:benchmark-*:1.4.0-alpha10 is released.
Android Developers
developer.android.com › app quality › write a microbenchmark
Write a Microbenchmark | App quality | Android Developers
Benchmarks are standard instrumentation tests. To create a benchmark, use the BenchmarkRule class provided by the library. To benchmark activities, use ActivityScenario or ActivityScenarioRule.
Google
android.googlesource.com › platform › frameworks › support › + › androidx-main › docs › benchmarking.md
Benchmarking in AndroidX
Just use the BenchmarkRule provided by the library: @RunWith(AndroidJUnit4::class) class ViewBenchmark { @get:Rule val benchmarkRule = BenchmarkRule() @Test fun simpleViewInflate() { val context = InstrumentationRegistry .getInstrumentation().targetContext val inflater = LayoutInflater.from(context) val root = FrameLayout(context) benchmarkRule.measure { inflater.inflate(R.layout.test_simple_view, root, false) } } }
Android Developers
developer.android.com › app quality › benchmark baseline profiles with macrobenchmark library
Benchmark Baseline Profiles with Macrobenchmark library | App quality | Android Developers
@RunWith(AndroidJUnit4ClassRunner::class) class ColdStartupBenchmark { @get:Rule val benchmarkRule = MacrobenchmarkRule() // No ahead-of-time (AOT) compilation at all. Represents performance of a // fresh install on a user's device if you don't enable Baseline Profiles— // generally the worst case performance.
Google
android.googlesource.com › platform › frameworks › support › + › 870f4590b5d3749d6275497c30a1520998372e42 › benchmark › docs › macrobenchmark.md
Jetpack Macrobenchmark Guide
Metrics are displayed directly in Android Studio, and also output for CI usage in a JSON file. While the existing Jetpack Benchmark library allows you to benchmark app code directly in a loop, it's designed around measuring CPU work which is run frequently, and which will hit best-case performance ...
Google
android.googlesource.com › platform › external › google-benchmark
platform/external/google-benchmark - Git at Google
To run the benchmark, compile and link against the benchmark library (libbenchmark.a/.so).
Android Developers
developer.android.com › codelabs › android-macrobenchmark-inspect
Inspect app performance with Macrobenchmark | Android Developers
In this codelab you'll learn to use the macrobenchmark library. You will measure app startup timing, which is a key metric for user engagement, and frame timing, which hints at where jank may occur in your app.
Reddit
reddit.com › r/androiddev › what you guys use for code benchmark?
r/androiddev on Reddit: What you guys use for code benchmark?
December 31, 2023 -
In recent blog, jake gave these metrics / benchmarks https://jakewharton.com/perils-of-duplicate-finding/#benchmarks. I want to, how to get this benchmarks. I too wanna test my code for TOE. So i some know how to achieve this. I have used difference in System.currentTimeinMillis() before and after the function. Can you suggest other alternative as this is not reliable metric?
Top answer 1 of 4
6
For Android, see https://developer.android.com/topic/performance/benchmarking/benchmarking-overview and the macrobenchmark and microbenchmark libraries. They are designed to help get measurements as stable as possible. However, in that article, Jake used jmh .
2 of 4
2
What are you trying to benchmark and why? Those are the questions I would lead with and then pick the tool.