mapbox-maps-android icon indicating copy to clipboard operation
mapbox-maps-android copied to clipboard

[Performance] dispatchTelemetryTurnstileEvent on main thread

Open florianPOLARSTEPS opened this issue 3 years ago • 1 comments

Environment

  • Android OS version: any
  • Devices affected: any
  • Maps SDK Version: 10.7.x - 10.8.x (but probably more)

Observed behavior and steps to reproduce

I have been doing some benchmarking of startup times for my screens that contain mapbox maps, and found that a significant portion of startup time comes from firing Turnstile events during mapcontroller startup.

I guess it's necessary to do those things, but do they really have to run on the main thread? Screenshot 2022-09-02 at 09 48 19

Expected behavior

Better startup performance of the map.

Notes / preliminary analysis

If you look at the screenshot of the CPU trace from Android studio, a lot of it comes from just reading the phone state (network info) from the system. I do not believe any of those system calls need to happen on the UI thread.

florianPOLARSTEPS avatar Sep 02 '22 08:09 florianPOLARSTEPS

@florianPOLARSTEPS I've created an internal task to check if it is still the case in latest versions of our SDK. Thanks for bringing it up.

kiryldz avatar Oct 26 '24 17:10 kiryldz

We have recently landed a improvement of start up time by avoid IPC calls(reading phone state) on main thread during dispatchTelemetryTurnstileEvent. You can get this fix with https://github.com/mapbox/mapbox-maps-android/releases/tag/v11.10.1 and above

pengdev avatar Mar 19 '25 16:03 pengdev