-
Notifications
You must be signed in to change notification settings - Fork 175
Description
Environment details
- Samunsg Galaxy A33 - Android 16 and other low-end devices. Though this was also visible on a Pixel 8, albeit not as bad as on lower-end devices.
- latest library version
Steps to reproduce
- In the sample app here change the number of clusters generated from 10 to 500
- run the sample app
- switch to CustomUiClustering (though its also visible with the default clustering)
- zoom in and out of the area with clusters
there is a visible lag, happening as soon as the POIs are clustered/unclustered. The profiler shows janky frames during that time that take up to 500ms, sometimes even more.
During that time the app is unresponsive.
I have been first experiencing this in my app where I have around 500 POIs on a rather small-ish area.
Using the NonHierarchicalViewBasedAlgorithm helps a bit, but does not get rid of all lag.
Trying the same steps with the xml version of google maps and clustering, there is no such lag happening.
I have been debugging this and found that the ComposeUiClusterRenderer does a lot of extra work that leads to re-rendering/repeated bitmap generation of unchanged POIs and re-creation of InvalidatingComposeView.
I invested some time into this and have a branch on my fork which works a lot smoother when combined with the NonHierarchicalViewBasedAlgorithm. At least the DefaultClustering is IMO on par with the xml version of google maps in terms of performance.
I'd be happy to open a PR and discuss how we can improve this further.