Skip to content

Migrate Baseline Profiles and Startup Profiles snippets - #1097

Open
pengzhi-cb wants to merge 11 commits into
android:mainfrom
StellarElements:katherinekuan/performance-snippets
Open

pengzhi-cb wants to merge 11 commits into
android:mainfrom
StellarElements:katherinekuan/performance-snippets

Conversation

@pengzhi-cb

@pengzhi-cb pengzhi-cb commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Code snippets are for:

  1. (1 snippet) https://developer.android.com/topic/performance/baselineprofiles/measure-baselineprofile
  2. (1 snippet) https://developer.android.com/topic/performance/baselineprofiles/overview
  3. (1 snippet) https://developer.android.com/topic/performance/startupprofiles/dex-layout-optimizations

Total: 3 code snippets (3 Kotlin and 0 XML) across 3 pages.

List of modifications
  1. 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).
  2. 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. Measure-baselineprofile page:
    1. None (all code snippets on the guide page are migrated).
  2. Overview page:
    1. None (all code snippets on the guide page are migrated).
  3. Dex-layout-optimizations page:
    1. None (all code snippets on the guide page are migrated).

@pengzhi-cb
pengzhi-cb requested a review from a team as a code owner September 14, 2026 18:17
@snippet-bot

snippet-bot Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 3 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@pengzhi-cb pengzhi-cb changed the title Katherinekuan/performance snippets Migrate snippet: more performance Sep 15, 2026
@pengzhi-cb
pengzhi-cb force-pushed the katherinekuan/performance-snippets branch from d5d4716 to 78e4622 Compare September 15, 2026 20:28
@kkuan2011

Copy link
Copy Markdown
Contributor

Is it possible to remove the new snippets from the misc folder? (We don't want to add any new snippets to that module). Can they go into the performance module, or do they need to go in the performance-samples repo?

@pengzhi-cb

Copy link
Copy Markdown
Contributor Author

Is it possible to remove the new snippets from the misc folder? (We don't want to add any new snippets to that module). Can they go into the performance module, or do they need to go in the performance-samples repo?

Oops, I did move them but the commit was lost when I move things into performance module. They are now in the proper module 2f42210

@pengzhi-cb
pengzhi-cb force-pushed the katherinekuan/performance-snippets branch from 502561b to edac329 Compare September 17, 2026 13:31

@kkuan2011 kkuan2011 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the move to the performance module, I think we're missingLaunchTime.kt file with its snippet?

Comment thread performance/build.gradle.kts
Comment thread performance/src/main/java/com/example/android/performance/jankstats/JankStats.kt Outdated
@pengzhi-cb

pengzhi-cb commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor Author

After the move to the performance module, I think we're missingLaunchTime.kt file with its snippet?

LaunchTime.kt is not missing, it's been added as part of the PR that creates the performance module. One of the reviewers wanted at least one file in the module so that it's not empty. Here is the PR: #1068

I also updated CL description to reflect this

@pengzhi-cb pengzhi-cb changed the title Migrate snippet: more performance Migrate Baseline Profiles and Startup Profiles snippets Oct 6, 2026

@kkuan2011 kkuan2011 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you Peng!

@kkuan2011

Copy link
Copy Markdown
Contributor

Can you rebase?

@kkuan2011
kkuan2011 requested a review from AjeshRPai October 6, 2026 23:44
Comment thread performance/build.gradle.kts Outdated
@pengzhi-cb
pengzhi-cb force-pushed the katherinekuan/performance-snippets branch 2 times, most recently from 52a29d7 to 79ddd23 Compare October 7, 2026 13:31
kkuan2011 and others added 11 commits October 7, 2026 13:33
…nitialization crashes

- Upgrade androidx-benchmark to 1.4.1 and androidx-uiautomator to 2.4.0.
- Relocate benchmarking tests from production source (src/main) to the test source set (src/androidTest).
- Fix startup crash by making `SplitInitializer` a static inner class in `ActivityEmbeddingJavaSnippets.java`.
- Update `AndroidManifest.xml` to correctly reference nested initializer classes using the `$` separator.
- Adopt the new UI Automator 2.4.0 in `BaselineProfilesOverview.kt`.
- Consolidate and clean up testing dependencies in `misc/build.gradle.kts`.
- Reorganize UI Automator library declaration in `libs.versions.toml` for better consistency.
- Remove static modifier from ActivityEmbeddingJavaSnippets.SplitInitializer
- Fix AndroidManifest App Startup meta-data inner class reference paths
- Update androidx-metrics to 1.0.0
@pengzhi-cb
pengzhi-cb force-pushed the katherinekuan/performance-snippets branch from 79ddd23 to 33457fd Compare October 7, 2026 13:33
@kkuan2011

Copy link
Copy Markdown
Contributor

LGTM

This branch has not been deployed

No deployments
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.

2 participants