-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unusable performance with >1k items in ClusterManager #1199
Comments
If you would like to upvote the priority of this issue, please comment below or react with 👍 so we can see what is popular when we triage.@mbilalhussain96 Thank you for opening this issue. 🙏
This is an automated message, feel free to ignore. |
A suggestion from @cwsiteplan in the Compose issue discussion:
|
is this fixed with googlemaps/android-maps-compose#421 ? |
@ColtonIdle , it is partially solved. Compose has an intrinsic lack of performance due to some limitations in the framework (i,e,, it has a penalty by using certain classes, and one of them is LatLng, which we use massively in a Cluster). So there is always going to be a level of lack of performance that we can't reduce (we are actually exploring this using a different mechanism, but that is another story). This PR allows to choose another algorithm for the rendering. Namely, I have added a sample to the repository, for more clarity: googlemaps/android-maps-compose#463 Feel free to check it out. |
Hm. so if we care about performance. we shouldn't use compose for clustering? |
At the moment, there is a certain level of intrinsic lack of performance in Compose. Again, we are exploring this (specifically, a new feature from the Compose 1.5.4 compiler called strong skipping). Unless you are trying to cluster thousands of them, Compose will likely work (as long as you are also using the |
Yeah, I currently have an app where we have about 16k items (mostly US and europe) hence my curiosity because we're not (yet) using compose maps. but we are using a fully compose android app with the exception of the map =) im really eager to ditch AndroidView though as I've had a bunch of issues with clusters not recomposing properly. thanks for the update. and strong skipping seems cool. i wonder if we can just mark latLng as @stable though? |
I would suggest you to check the Clustering with |
Hi, one of the Compose devs here :) Could you share a bit more about performance problems you have encountered? I am not personally familiar with Compose integration for Maps, but I'd be happy to chat about it and help debug / address perf issues with it. |
Hi @ShikaSD , The issue is happening in android-maps-compose. It is likely related to this issue here, with the LatLng type not being inferred as stable. Setting the stability via a config file and using strong skipping does not seem to fully remove the issue. |
@kikoso stability by itself does not result in performance problems that often, I doubt this is the cause here. I suspect the problem is in heavy content used for clusters. I'll look into attached issue a bit more. |
I ran a quick profile on the clustering sample with 1000 items. I think the new strategy that changes the viewport should help quite a lot, as it creates less items in general. For Compose clusters, majority of the time is spent in creating and setting up |
Can anyone verify that using cc @ColtonIdle |
@mbilalhussain96 , could you eventually share your implementation of |
For anyone that was curious of how to grab height and width from compose code, you can see a discussion I brought up in kotlinlang slack: https://slack-chats.kotlinlang.org/t/16243087/what-would-be-the-compose-way-of-grabbing-these-window-value#eb72b9b4-d4a9-462d-bbd7-c727dfed29d3 |
TL;DR is use |
If I add over 1k items to the ClusterManager, the actual (drawn) markers are updated after very long delays. For example, I can have one cluster with "1000+" text on it, and when I zoom in, it stays for about 1-2 minutes, and only after that it splits into smaller clusters and markers.
The text was updated successfully, but these errors were encountered: