Skip to content

perf: ship Baseline Profiles in maps-compose, maps-compose-utils and maps-compose-widgets - #1063

Open
kikoso wants to merge 1 commit into
mainfrom
feat/baseline-profiles
Open

kikoso wants to merge 1 commit into
mainfrom
feat/baseline-profiles

Conversation

@kikoso

@kikoso kikoso commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

None of the three libraries ship a Baseline Profile today, so apps using them run the map setup, marker and clustering code interpreted/JIT until ART compiles it. This PR adds the profiles and the tooling to regenerate them.

  • New :baselineprofile module (com.android.test, Benchmark 1.5.0) targeting maps-app. BaselineProfileGenerator opens the demos that cover the public API (basic map, map in column, advanced markers, clustering, markers collection, draggable markers with polygon, tile and ground overlays, ScaleBar), pans and zooms the map in each one.
  • maps-compose, maps-compose-utils and maps-compose-widgets apply the androidx.baselineprofile consumer plugin, so the generated src/main/generated/baselineProfiles/baseline-prof.txt gets packaged in the AAR (882, 110 and 31 rules).
  • StartupBenchmark compares cold startup and frame timing of the markers and clustering demos with CompilationMode.None against the Baseline Profiles. To run on a physical device: ./gradlew :baselineprofile:connectedBenchmarkReleaseAndroidTest.
  • AGENTS.md explains how to regenerate the profiles.

A few points worth to mention

  • Build types in maps-app. With AGP 9.4.1 the plugin does not create nonMinifiedRelease and benchmarkRelease in maps-app (same with Benchmark 1.6.0-alpha01 and with android.newDsl=false), and the generation then silently runs 0 tests. They are declared explicitly in maps-app/build.gradle.kts with the same settings the plugin would apply (not minified, not debuggable, profileable, no coverage instrumentation, debug signing). We can drop them once the plugin handles it.
  • Shared root package. maps-app uses com.google.maps.android.compose as well, and the plugin filter only supports pkg.**, pkg.* or exact class names, so 357 of the 1,239 rules of maps-compose were demo classes (MainActivity, DemoKt, ComposableSingletons$BasicMapActivityKt...). A small step after copyBaselineProfileIntoSrc keeps only the rules for classes this library compiles (D8 $$ExternalSynthetic* and $-CC classes are kept for their owner). maps-compose-utils and maps-compose-widgets have their own packages, so the filter is enough there.
  • Street View is not covered. StreetViewActivity crashes when driven by the generator on API 36, so is left out of the journey for now.
  • Demos are started with am start -W instead of startActivityAndWait, which could not confirm the launch on the map screens.
  • No new runtime dependency: the published POM and .module have no reference to :baselineprofile, and ProfileInstaller already comes transitively with Compose.

Testing

  • Profiles generated on an API 36 emulator with a real key.
  • baseline-prof.txt is present in the three release AARs and absent of demo classes.
  • Library unit tests, assembleDebug, lint and the CI build koverXmlReportDebug command pass locally.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

Coverage (unit tests)

Compared against 174f0fd on main (#1060).

Module Line % Change Branch % Change
maps-compose 15.28% no change 3.76% no change
maps-compose-utils 6.09% no change 4.47% no change
maps-compose-widgets 10.88% no change 11.11% no change
TOTAL 12.99% no change 4.12% no change

Line and branch coverage from unit test reports. History is recorded on the coverage-history branch after each merge to main.

@googlemaps-bot

Copy link
Copy Markdown
Contributor

Coverage (instrumentation tests)

Overall Project 43.69% 🍏

There is no coverage information present for the Files changed

…maps-compose-widgets

Add a :baselineprofile module that generates the profiles from the maps-app
demos, and package the generated baseline-prof.txt in the three library AARs.
It also contains a StartupBenchmark to measure the effect.

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.

3 participants