We've got an in-progress Xamarin Forms 5 app where we need to load ~48k structure points from Entity Framework/sqlite (via direct SQL query) and present them on a map via Graphics Overlays.
The MapPoint constructor seems to be rather expensive, taking roughly 20 seconds to cycle through the structures. Adding the created MapPoints to Graphics Overlays and presenting them on the map is extremely fast, it's just the initial creation of the points that is slowing things down.
We've looked into somehow persisting the MapPoint object however despite having JSON import/export functions the object itself is not serializable so we can't keep them around between sessions. This is put us in a bit of a quandary where we are having to pull UI tricks and alter workflows do disguise the poor performance when loading the structures into the map.
Any ideas on how we might be able store and retrieve MapPoint objects on mobile? Any chance we might be able to actually serialize geometry objects? Our spec requires licensing at the Lite level so we can't do a local Mobile Geodatabase to stash points, and we've tried various alternate methods of generating points (PointBuilder, from JSON, from Coordinate String) but they all seem to have the same performance issue.
Solved! Go to Solution.
Hello Michael! In general, the fastest way to create point Graphics in Runtime is:
Some performance best practices and micro-optimizations to follow:
You can find more performance advice in this recently-updated developer guide topic: Performance considerations. You can also check out this 10-minute demo from DevSummit 2022 that focused on Graphic performance (relevant part starts around 22:30).
I would also encourage you to measure which parts of the process account for most time, and to check the official EFCore performance tips. I would be glad to look into specifics of your app to see how we can help achieve better performance!
Hello Michael! In general, the fastest way to create point Graphics in Runtime is:
Some performance best practices and micro-optimizations to follow:
You can find more performance advice in this recently-updated developer guide topic: Performance considerations. You can also check out this 10-minute demo from DevSummit 2022 that focused on Graphic performance (relevant part starts around 22:30).
I would also encourage you to measure which parts of the process account for most time, and to check the official EFCore performance tips. I would be glad to look into specifics of your app to see how we can help achieve better performance!
Thanks for your response - implemented all of your suggestions (including minimizing fields coming from EF) and brought the load time down from 20-40sec to 2 seconds flat.
Unfortunately this project requires AppCenter and MSAL - which are total no-go for MAUI right now so .net 6 is off the table. Looking forward to checking out the performance improvements once MAUI is a little more mature.. maybe .net 7 at this point.