maplibre / flutter-maplibre-gl

Customizable, performant and vendor-free vector and raster maps, flutter wrapper for maplibre-native and maplibre-gl-js (fork of flutter-mapbox-gl/maps)
https://pub.dev/packages/maplibre_gl
Other
186 stars 106 forks source link

Use isolates to encode features #367

Closed T-moz closed 1 week ago

T-moz commented 5 months ago

Fixes https://github.com/maplibre/flutter-maplibre-gl/issues/366

Wrapping jsonEncode in a compute allow data encoding without blocking the main isolate. BUT Spawning multiple isolate is very expensive, and can lead to crash. So this technique is better used when encoding multiple geojsonFeature.


Currently, I have a performance issues on my app, when updating multiple lines. So I coded a fix that solves only this issue. But this principle could be applied to symbols, circles, polygones, and to the method setGeoJsonSource.

I willing to work on this, but first, I need review and feedbacks on this first implementation 🙏.

josxha commented 1 week ago

I red through the linked issue https://github.com/maplibre/flutter-maplibre-gl/issues/366 and think that the discussed solution to add a low level-ish method like addEncodedGeoJsonSource would be a better solution. I hope it's alright if I close this pull request? If not, just let me know. (: