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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
130
Measure What Matters with Jetpack Benchmark
bennegeek
0
84
Droidkaigi 2019 flutter kotlin native
bennegeek
2
600
Fast Prototypes using Kotlin_Native (and Flutter)
bennegeek
1
84
kotlin-native-workshop.pdf
bennegeek
0
130
Fast Prototypes with Flutter + Kotlin/Native
bennegeek
0
580
Featured
See All Featured
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
160
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
210
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
480
Unsuck your backbone
ammeep
672
58k
Claude Code のすすめ
schroneko
67
230k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
260
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
390
Building Adaptive Systems
keathley
44
3.1k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
How to Ace a Technical Interview
jacobian
281
24k
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