mapbox/mapbox-base-android

10 Annotations a second causes significant performance issues

crroush opened this issue · 1 comments

We are running an instance of mapbox 10.4.0, using the circleAnnotationManager to receive lat/lon points and display them on the map. There is a kotlin sharedflow that delivers the ingests the data and makes it available to the viewmodel for displaying on the map. The data is coming in at a rate of 100 msec a point. Watching the profile in Android studio it shows that GEOJSON_PARSER is eating up nearly 50+% of the available resources. This makes the map unusable.

image

This image from the Android Studio profiler shows what appears to be taking what is passed through the circleAnnotationManager, converting it to geojson, then doing an http post internally (maybe between the java and native side?) and I assume it must be converting it back from geojson on the native side?
This sequence happens every time a new point is added to the circleManager.

This is how I am creating my CircleAnnotationOptions:

fun getCircleAnnotation( point: Point, color: Color, radius: Double = 8.0): CircleAnnotationOptions{
    return CircleAnnotationOptions()
        .withPoint(point)
        .withCircleColor(color.toArgb())
        .withCircleStrokeColor(color.toArgb())
        .withCircleRadius(radius)
}

Then I add the circle using the circleAnnotationManager:

 circleManager.create(circleAnnotationOptions)

Closing and moving to the correct repository