Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Jetpack Benchmark - Droidcon RO 2019
Search
JB Lorenzo
October 04, 2019
130
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
200
Lessons Learned from Using Kotlin Multiplatform internally
bennegeek
0
140
Measure What Matters with Jetpack Benchmark
bennegeek
0
93
Droidkaigi 2019 flutter kotlin native
bennegeek
2
610
Fast Prototypes using Kotlin_Native (and Flutter)
bennegeek
1
90
kotlin-native-workshop.pdf
bennegeek
0
130
Fast Prototypes with Flutter + Kotlin/Native
bennegeek
0
580
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
100
6.3k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
690
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
450
The World Runs on Bad Software
bkeepers
PRO
72
12k
Between Models and Reality
mayunak
4
460
The Cult of Friendly URLs
andyhume
79
7k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
4 Signs Your Business is Dying
shpigford
187
23k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
67
58k
[RailsConf 2023] Rails as a piece of cake
palkan
59
7k
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