Repository navigation
Migrate performance snippets - #372
pengzhi-cb wants to merge 4 commits into
Conversation
agammann
left a comment
There was a problem hiding this comment.
The new snippets module declares applicationId = "com.example.android.performance", while its three instrumented benchmark/profile tests launch com.example.snippets, com.example.macrobenchmark.target, and com.example.app. Since those packages are not provided here, connectedAndroidTest will discover tests that cannot run. Could the snippet-only tests be kept out of the runnable test suite, or be wired to a target app?
- UI Automator 2.4.0-alpha06 -> 2.4.1, Benchmark 1.4.1 -> 1.5.0, Activity 1.11.0 -> 1.13.0, Compose BOM 2025.11.00 -> 2026.06.01, Lifecycle 2.9.4 -> 2.10.0, Kotlin 2.2.21 -> 2.4.21, AGP 8.13.1 -> 8.13.2, Gradle 8.14.3 -> 8.14.7 (with the distribution checksum pinned). Newer Compose and Lifecycle releases need compileSdk 37 and AGP 9. - Depend on lifecycle-runtime: lifecycle-runtime-ktx is empty since 2.8.0. - UI Automator 2.4.1 has no startIntent(); the startup profile snippet now calls startActivityIntent(), which its comment already names. - Sort the dependency and version entries alphabetically. - End two snippet comments with a full stop.
|
Thanks. These three classes are there so the snippets on the Baseline Profiles and startup profile pages compile. The package names come from those pages, and no target app for them exists in this repository, so they are not meant to run. The CI workflow I'm adding for If you'd rather keep them out of the instrumented test APK, I can move them to a separate source set that only compiles. Which do you prefer? |
The Baseline Profile and Macrobenchmark snippet classes sit in androidTest so they compile. A comment outside each region says that in an app they live in a separate com.android.test module.
|
I pushed two commits on top of this PR. I can't edit the PR description from my account, so here are the changes it doesn't cover yet. Visible changes to published code:
Other changes:
|
|
Thanks for clarifying. I’d prefer the separate compile-only source set. Please keep all three snippets in the CI compile check and out of the instrumented test APK. That keeps the documentation examples checked without having |
Code snippets are for:
Total: 9 code snippets (6 unique Kotlin snippets and 0 XML snippets) across 6 pages.
List of modifications
...placeholders with// ...comments and added braces{ ... }around theif (BuildConfig.DEBUG)body inMyApplication.onCreate()(android_performance_appstartup_strict_modeinAnalysisOptimization.kt).{ mutableStateOf(false) }inandroid_compose_performance_conditional_compositionandandroid_compose_performance_conditional_composition_effect(AnalysisOptimization.kt).android_compose_performance_conditional_compositionandandroid_compose_performance_conditional_composition_effectinAnalysisOptimization.kt, and normalized indentation from 3 spaces to 4 spaces.when(activityState)towhen (activityState)inMainActivity.onCreate()(android_performance_launch_time_fully_drawn_reporterinLaunchTime.kt).@RunWith(AndroidJUnit4ClassRunner::class)with@RunWith(AndroidJUnit4::class), fixed parameter namewarmupIteration = 3towarmupIterations = 3inCompilationMode.Partial(...), and normalized spacing before the closing brace on line 76 (android_performance_baselineprofiles_measure_compilation_modesinMeasureBaselineProfile.kt).}for theuiAutomatorblock so the snippet compiles and formattedstartIntent(...)across multiple lines (android_performance_startupprofiles_generatorinDexLayoutOptimizations.kt).Snippets not migrated
adbshell command examples).