mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.35k stars 1.33k forks source link

App taking SUUUUUPER long to start up if user has a lot of offline maps #16519

Open georgbachmann opened 3 years ago

georgbachmann commented 3 years ago

I am currently playing around with the mapbox for iOS SDK and tried to download a huge offline map. I then noticed when starting the app afterwards, that it takes forever until the app is really loaded. I started investigating with Instruments and found mbgl::OfflineDatabase::initAmbientCacheSize() (running the sql-query in there) taking about 9 seconds in my case. Also, when I initialize MGLOfflineStorage on app launch (to check for unfinished downloads) it will take even longer (hanging in mbgl::OfflineDatabase::getCompletedTileCountAndSize(long long).

Also... while downloading the offline map, my iPhone get really really hot (100% CPU usage while downloading) and in the logs I also saw: QUARANTINED DUE TO HIGH LOGGING VOLUME

Is there anything to do about the problem?

Steps to reproduce

  1. Download a super large offline map region

Expected behavior

No difference in app-start time

Actual behavior

App hangs forever to start up

Configuration

Mapbox SDK versions: 6.0 iOS/macOS versions: 13.6 Device/simulator models: iPhone X Xcode version: 11.6