-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[iOS] Low performance with 100+ markers with identical image #1176
Comments
@hughvidos I have found and confirmed that the lagging is due to the sheer number of UIViews being created for every marker regardless of rather they were using same image or not. I have tried re-using UIImage and 750+ markers gives me solid 55+ FPS even when panning around. |
@ericapply Could you please take a look at this issue? #1031 Thanks |
@vinceyuan Can you try to use my PR and try to see if it still causes high CPU %? |
@ericapply I tried it. CPU % is still high. Because there is only one marker, reusing view does not help #1031 |
Even with a few markers it's using a >75% of CPU. Did anyone find a workaround? Thank you |
Same here.. even with 1 marker |
same for me, only laggy when using custom markers, even one marker makes it laggy |
+1 |
Are you re-rendering map? Could someone provide a test repo reproducing performance problem? |
Follow in #369 |
Hey, I solved my problem and this could help somebody else too. I ended up using the image prop on the marker component to display whatever custom component I need. In my usecase I was implementing clustering using supercluster, I wanted to display a number of clusterized pins. I generated my images from here: https://dummyimage.com - about a hundred. Then a designer converted them to circles with a transparent background automatically with a Photoshop action and I loaded them in my application. 100 images were as small as 60kB so it's not a big hit that I have them all in the app. |
Description
I am using react-native-maps to draw about 100 markers on the map.
Each marker is using same Image
Reproduction Steps and Sample Code
Possible Solution
Re-using UIImage
http://stackoverflow.com/questions/25555778/optimising-custom-marker-image-performance-with-google-maps-sdk-for-ios
Currently AIRMapMarker.m and AIRGoogleMapMarker.m does not re-use UIImage and constantly allocates a new one. This is a huge performance hit when you want to cluster markers and want to pan around (constant allocation and garbage collection of UIImage).
Currently there is a way to provide 'image' prop directly to Marker (the way I am doing in the code above). There should be a dictionary of <NSString, UIImage> for MapView and re-use the UIImage when imageSrc is same.
Additional Information
The text was updated successfully, but these errors were encountered: