Skip to content

perf: improve MarkerComposable rendering performance#881

Open
brucemok8 wants to merge 1 commit intogooglemaps:mainfrom
brucemok8:perf/improves-marker-composable-rendering-performance
Open

perf: improve MarkerComposable rendering performance#881
brucemok8 wants to merge 1 commit intogooglemaps:mainfrom
brucemok8:perf/improves-marker-composable-rendering-performance

Conversation

@brucemok8
Copy link

Summary

This PR improves the rendering performance of MarkerComposable, particularly when displaying a larger number of markers with frequently updating content.

Changes

  • Reuse ComposeView instances instead of creating and disposing them for each render. The view is retained and used to generate updated bitmaps when marker keys change, and disposed only when the marker is removed.
  • Move renderComposableToBitmapDescriptor() off the main thread to avoid blocking the UI.
  • Update rememberComposeBitmapDescriptor to return a nullable type. Callers skip rendering until the bitmap is ready, preventing main thread blocking and allowing markers to appear asynchronously.

Impact

These changes significantly reduce UI jank during marker updates. In testing, scenarios with ~25 dynamically updating markers show noticeably smoother performance.

@google-cla
Copy link

google-cla bot commented Mar 27, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@brucemok8 brucemok8 force-pushed the perf/improves-marker-composable-rendering-performance branch from 6bec4de to f9ba7e5 Compare March 27, 2026 05:11
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