oscarfonts / mapbox-gl-cordova-offline

Offline vector maps in Cordova using Mapbox GL JS
Other
60 stars 36 forks source link

inflate tiles natively #13

Open jpilet opened 6 years ago

jpilet commented 6 years ago

currently, tiles are decompressed from the sqlite database in the main javascript thread.

It would be faster to decompress natively using a cordova plugin, or even a sqlite C function.

The inflate call is here https://github.com/oscarfonts/mapbox-gl-cordova-mbtiles/blob/master/src/mbtiles_source.js#L93

oscarfonts commented 6 years ago

In previous versions the decompression was made in a worker thread: https://github.com/oscarfonts/mapbox-gl-cordova-mbtiles/blob/v0.0.6/src/mbtiles_worker.js#L10

A later contribution merge moved the decompression to the main thread, and there it is. It may be a good idea to move the decompression back to the worker.

Indeed, it would be even better to support native decompression. Would you give it a try? ;)