Skip to content

Migrate performance snippets - #371

Open
pengzhi-cb wants to merge 2 commits into
android:mainfrom
pengzhi-cb:pquah/performance-snippets
Open

pengzhi-cb wants to merge 2 commits into
android:mainfrom
pengzhi-cb:pquah/performance-snippets

Conversation

@pengzhi-cb

Copy link
Copy Markdown

Code snippets are for:

  1. (3 snippets) https://developer.android.com/topic/performance/appstartup/analysis-optimization
  2. (2 snippets) https://developer.android.com/topic/performance/appstartup/best-practices
  3. (1 snippet) https://developer.android.com/topic/performance/issues/launch-time
  4. (1 snippet) https://developer.android.com/topic/performance/baselineprofiles/measure-baselineprofile
  5. (1 snippet) https://developer.android.com/topic/performance/baselineprofiles/overview
  6. (1 snippet) https://developer.android.com/topic/performance/startupprofiles/dex-layout-optimizations

Total: 9 code snippets (6 unique Kotlin snippets and 0 XML snippets) across 6 pages.

List of modifications
  1. Analysis-optimization page: Replaced standalone ... placeholders with // ... comments and added braces { ... } around the if (BuildConfig.DEBUG) body in MyApplication.onCreate() (android_performance_appstartup_strict_mode in AnalysisOptimization.kt).
  2. Analysis-optimization page: Normalized indentation to 4 spaces and added spaces inside { mutableStateOf(false) } in android_compose_performance_conditional_composition and android_compose_performance_conditional_composition_effect (AnalysisOptimization.kt).
  3. Best-practices page: Consolidated duplicate conditional composition blocks with the Analysis-optimization page by sharing android_compose_performance_conditional_composition and android_compose_performance_conditional_composition_effect in AnalysisOptimization.kt, and normalized indentation from 3 spaces to 4 spaces.
  4. Launch-time page: Formatted when(activityState) to when (activityState) in MainActivity.onCreate() (android_performance_launch_time_fully_drawn_reporter in LaunchTime.kt).
  5. Measure-baselineprofile page: Replaced internal runner @RunWith(AndroidJUnit4ClassRunner::class) with @RunWith(AndroidJUnit4::class), fixed parameter name warmupIteration = 3 to warmupIterations = 3 in CompilationMode.Partial(...), and normalized spacing before the closing brace on line 76 (android_performance_baselineprofiles_measure_compilation_modes in MeasureBaselineProfile.kt).
  6. Dex-layout-optimizations page: Added the missing closing brace } for the uiAutomator block so the snippet compiles and formatted startIntent(...) across multiple lines (android_performance_startupprofiles_generator in DexLayoutOptimizations.kt).
Snippets not migrated
  1. Analysis-optimization page:
    1. None (all 3 code snippets on the guide page are migrated).
  2. Best-practices page:
    1. None (all 2 code snippets on the guide page are migrated).
  3. Launch-time page:
    1. None (all Kotlin code snippets on the guide page are migrated; lines 239–241, 266–268, 281–286, 291–298, and 339–341 are Logcat output and adb shell command examples).
  4. Measure-baselineprofile page:
    1. None (all code snippets on the guide page are migrated).
  5. Overview page:
    1. None (all code snippets on the guide page are migrated).
  6. Dex-layout-optimizations page:
    1. None (all code snippets on the guide page are migrated).

@pengzhi-cb
pengzhi-cb marked this pull request as ready for review October 27, 2026 18:28
@pengzhi-cb
pengzhi-cb requested a review from a team as a code owner October 27, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant