Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Jetpack Benchmark - Droidcon RO 2019
Search
JB Lorenzo
October 04, 2019
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Jetpack Benchmark - Droidcon RO 2019
JB Lorenzo
October 04, 2019
More Decks by JB Lorenzo
See All by JB Lorenzo
Measure What Matters with Jetpack Benchmark
bennegeek
0
190
Lessons Learned from Using Kotlin Multiplatform internally
bennegeek
0
140
Measure What Matters with Jetpack Benchmark
bennegeek
0
86
Droidkaigi 2019 flutter kotlin native
bennegeek
2
600
Fast Prototypes using Kotlin_Native (and Flutter)
bennegeek
1
88
kotlin-native-workshop.pdf
bennegeek
0
130
Fast Prototypes with Flutter + Kotlin/Native
bennegeek
0
580
Featured
See All Featured
For a Future-Friendly Web
brad_frost
183
10k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
760
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
270
Automating Front-end Workflow
addyosmani
1370
210k
First, design no harm
axbom
PRO
2
1.2k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Tell your own story through comics
letsgokoyo
1
1k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
200
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
330
WCS-LA-2024
lcolladotor
0
790
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
760
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
260
Transcript
@bennegeek Measure What Matters with Jetpack Benchmark JB Lorenzo |
#DroidconRO19
None
@bennegeek
@bennegeek
@bennegeek
@bennegeek Benchmark 1.0.0-alpha06 September 18, 2019 alpha01 on May 7
@bennegeek From alpha02 to alpha06 * Auto disables test coverage
* AndroidBenchmarkRunner by default * Module structure changed to decouple JUnit4 * Change in package name * Documentation for CI integration
@bennegeek Documentation for CI Integration https://developer.android.com/studio/profile/run-benchmarks-in-ci * Guidelines for benchmark
without Gradle * Self-instrumented APK * Separate app and test APKs * Guidelines for CI * Important flags (e.g. lock clocks, json output)
@bennegeek Setting up Android Studio 3.5 Beta npw.benchmark.template.module=true
@bennegeek Setting up
@bennegeek Setting up your.package.name.
@bennegeek Setting up dependencies { androidTestImplementation “androidx.benchmark:benchmark:1.0.0-alpha06" }
@bennegeek Setting up <application android:debuggable="false" tools:ignore="HardcodedDebugMode" tools:replace="android:debuggable"/>
@bennegeek Let’s measure!
@bennegeek @mootazltaief
@bennegeek @mootazltaief
@bennegeek Firebase Test Lab Amazon EC2 + Emulator Your Own
Device Farm
@bennegeek Firebase Test Lab Amazon EC2 + Emulator Your Own
Device Farm
@bennegeek Firebase Test Lab Amazon EC2 + Emulator Your Own
Device Farm
@bennegeek Amazon EC2 + Emulator AWS: * Does not allow
nested VM * Need to run bare-Metal instance to run emulator Emulator: * Not advised for benchmarks Other cloud providers: * has support for nested VM
@bennegeek Integrating in Gitlab CI // benchmark/build.gradle apply plugin: androidx.benchmark
// if device/emulator is connected to CI > ./gradlew benchmark:connectedCheck
@bennegeek Integrating in Gitlab CI { "context": { "build": {
"device": "generic_x86_64", "fingerprint": "google/sdk_gphone_x86_64/generic_x86_64:9/PSR1.180720.075/5124027:userdebug/dev-keys", "model": "Android SDK built for x86_64", "version": { "sdk": 28 } }, "cpuLocked": false, "sustainedPerformanceModeEnabled": false }, "benchmarks": [ { "name": "EMULATOR_UNLOCKED_benchmarkJacksonWithSample1", "className": "benchmark.JsonBenchmark", "metrics": { "timeNs": { "minimum": 94500, "maximum": 692250, "median": 138375, "runs": [ 96500,
@bennegeek Integrating in Gitlab CI { "context": { "build": {
"device": "generic_x86_64", "fingerprint": "google/sdk_gphone_x86_64/generic_x86_64:9/PSR1.180720.075/5124027:userdebug/dev-keys", "model": "Android SDK built for x86_64", "version": { "sdk": 28 } }, "cpuLocked": false, "sustainedPerformanceModeEnabled": false }, "benchmarks": [ { "name": "EMULATOR_UNLOCKED_benchmarkJacksonWithSample1", "className": "benchmark.JsonBenchmark", "metrics": { "timeNs": { "minimum": 94500, "maximum": 692250, "median": 138375, "runs": [ 96500,
@bennegeek Integrating in Gitlab CI { "context": { "build": {
"device": "generic_x86_64", "fingerprint": "google/sdk_gphone_x86_64/generic_x86_64:9/PSR1.180720.075/5124027:userdebug/dev-keys", "model": "Android SDK built for x86_64", "version": { "sdk": 28 } }, "cpuLocked": false, "sustainedPerformanceModeEnabled": false }, "benchmarks": [ { "name": "EMULATOR_UNLOCKED_benchmarkJacksonWithSample1", "className": "benchmark.JsonBenchmark", "metrics": { "timeNs": { "minimum": 94500, "maximum": 692250, "median": 138375, "runs": [ 96500,
@bennegeek Integrating in Gitlab CI { "context": { "build": {
"device": "generic_x86_64", "fingerprint": "google/sdk_gphone_x86_64/generic_x86_64:9/PSR1.180720.075/5124027:userdebug/dev-keys", "model": "Android SDK built for x86_64", "version": { "sdk": 28 } }, "cpuLocked": false, "sustainedPerformanceModeEnabled": false }, "benchmarks": [ { "name": "EMULATOR_UNLOCKED_benchmarkJacksonWithSample1", "className": "benchmark.JsonBenchmark", "metrics": { "timeNs": { "minimum": 94500, "maximum": 692250, "median": 138375, "runs": [ 96500, 95250, ...
@bennegeek Integrating in Gitlab CI { "context": { "build": {
"device": "generic_x86_64", "fingerprint": "google/sdk_gphone_x86_64/generic_x86_64:9/PSR1.180720.075/5124027:userdebug/dev-keys", "model": "Android SDK built for x86_64", "version": { "sdk": 28 } }, "cpuLocked": false, "sustainedPerformanceModeEnabled": false }, "benchmarks": [ { "name": "EMULATOR_UNLOCKED_benchmarkJacksonWithSample1", "className": "benchmark.JsonBenchmark", "metrics": { "timeNs": { "minimum": 94500, "maximum": 692250, "median": 138375, "runs": [ 96500,
@bennegeek Benchmark Warnings
@bennegeek Benchmark Warnings
@bennegeek Benchmark Warnings
@bennegeek Benchmark Warnings
@bennegeek Benchmark Warnings
@bennegeek Benchmark Warnings
@bennegeek Benchmark Warnings
@bennegeek Benchmark Warnings
@bennegeek Benchmark Warnings
@bennegeek Benchmark Warnings
@bennegeek Firebase Test Lab Amazon EC2 + Emulator Your Own
Device Farm
@bennegeek Firebase Test Lab Amazon EC2 + Emulator Your Own
Device Farm
@bennegeek Firebase Test Lab Integration with CI Firebase Test Lab
* Problems when running test with mocked network * $5/device/hour after Free tier * Need to configure gcloud in CI * Fetch results in google cloud storage
@bennegeek Firebase Test Lab Integration with CI Firebase Test Lab
How to get the json output from test lab?
@bennegeek Gitlab CI
@bennegeek Gitlab CI
@bennegeek Gitlab CI #!/bin/sh cat benchmark/build/benchmark_reports/*/*.json | python -c '''
import sys, json; benchmarks = json.load(sys.stdin)["benchmarks"] medians = {v["name"] : v["metrics"]["timeNs"]["median"] for v in benchmarks} … '''
@bennegeek Gitlab CI #!/bin/sh cat benchmark/build/benchmark_reports/*/*.json | python -c '''
import sys, json; benchmarks = json.load(sys.stdin)["benchmarks"] medians = {v["name"] : v["metrics"]["timeNs"]["median"] for v in benchmarks} … '''
@bennegeek Gitlab CI #!/bin/sh cat benchmark/build/benchmark_reports/*/*.json | python -c '''
import sys, json; benchmarks = json.load(sys.stdin)["benchmarks"] medians = {v["name"] : v["metrics"]["timeNs"]["median"] for v in benchmarks} … '''
@bennegeek Gitlab CI #!/bin/sh cat benchmark/build/benchmark_reports/*/*.json | python -c '''
import sys, json; benchmarks = json.load(sys.stdin)["benchmarks"] medians = {v["name"] : v["metrics"]["timeNs"]["median"] for v in benchmarks} … '''
@bennegeek Gitlab CI PreviousBenchmark = 138375 Threshold = 0.10 if
medians["benchmarkJacksonWithSample1"] > (PreviousBenchmark * Threshold): print("benchmarkJacksonWithSample1 is beyond threshold") exit(1)
@bennegeek Output
@bennegeek Output
@bennegeek Output
@bennegeek Next Steps * Separate app into modules * Mock
more data for benchmarking * Try it out yourself
@bennegeek Next Steps * Separate app into modules * Mock
more data for benchmarking * Try it out yourself * Visit the issue tracker * File bugs
@bennegeek tech.olx.com Example project (No OLX code): http://github.com/mootazltaief/ android-json-benchmark
@bennegeek tech.olx.com https://issuetracker.google.com/ issues?q=componentid: 585351%20status:open
None
@bennegeek tech.olx.com
None
None
Berlin Buenos Aires Lisbon New Delhi Poznan Dubai
@bennegeek Multumesc! vreo întrebare? Get in touch with us olxgroup.com
tech.olx.com olxtechberlin
[email protected]
jblorenzo JB Lorenzo | #DroidconRO19