If we proceed with this, it will also happen on Android.
Per voice with @kkaefer, our shape annotation implementation in #1655 could be improved by creating a layer grouping API identically-styled shapes.
Currently, each shape annotation gets its own style layer for reasons of:
- Eventual z-ordering by the client, much like MapKit's
insertOverlay:aboveOverlay:.
- Styling, as shapes in the same layer get the same styling.
However, performance is a concern here. Adding 10,000 similarly-styled shapes means 10,000 more style layers, which means 10,000 more GL draw calls. 🚨 NOT TENABLE 🚨
If we introduced the concept of a shape group for identically-styled shapes, a consumer could add 10,000 blue polylines to the map and incur 1 style layer and 1 draw call.
Instead of:
mapView.addAnnotation(polyline1)
mapView.addAnnotation(polyline2)
// ...
mapView.addAnnotation(polyline10000)
It would look something like:
let polylineGroup = MGLMultiPointGroup
polylineGroup.addObject(polyline1)
polylineGroup.addObject(polyline2)
// ...
polylineGroup.addObject(polyline10000)
mapView.addAnnotationGroup(polylineGroup)
This would also allow functionality like:
- Easy restyling of shape groups
- Easy toggling of hide/show for shape groups
We would still support mapView.addAnnotation(polyline) like MapKit, with the understanding that it's more efficient to add many shapes with the groups API instead.
Thoughts @1ec5 @friedbunny?
If we proceed with this, it will also happen on Android.
Per voice with @kkaefer, our shape annotation implementation in #1655 could be improved by creating a layer grouping API identically-styled shapes.
Currently, each shape annotation gets its own style layer for reasons of:
insertOverlay:aboveOverlay:.However, performance is a concern here. Adding 10,000 similarly-styled shapes means 10,000 more style layers, which means 10,000 more GL draw calls. 🚨 NOT TENABLE 🚨
If we introduced the concept of a shape group for identically-styled shapes, a consumer could add 10,000 blue polylines to the map and incur 1 style layer and 1 draw call.
Instead of:
It would look something like:
This would also allow functionality like:
We would still support
mapView.addAnnotation(polyline)like MapKit, with the understanding that it's more efficient to add many shapes with the groups API instead.Thoughts @1ec5 @friedbunny?