mapbox / mapbox/mapbox-maps-flutter
addSource / updateGeoJSON slow performance on Android
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 380
- Forks
- 204
- PR merge metrics
- No merged PRs in 30d
Description
When loading a 1 megabyte GeoJSON source to a map style and measure the time, I see a huge performance difference between Android and iOS.
```
var dateTimeNow = DateTime.now();
await mapboxMap?.style.addSource(
GeoJsonSource(
id: "my_source",
data: jsonEncode(myGeoJSON)
)
);
print(DateTime.now().difference(dateTimeNow).inMilliseconds);
```
Android: **1500ms** (sometimes even more)
iOS: **130ms**
I tested on Emulators as well as physical devices, the results are the same.
The same behaviour also occurs when using _source.updateGeoJSON(...)_.
When building a native Android app, working with large GeoJSON sources in Mapbox did not result in performance issues like this.
Here you can find the full sample project:
[flutter_mapbox.zip](https://github.com/mapbox/mapbox-maps-flutter/files/15348755/flutter_mapbox.zip)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the timing difference with the attached flutter_mapbox.zip sample, focusing on style.addSource with a 1 MB GeoJSON source and source.updateGeoJSON(...). Compare Android and iOS timings and investigate the Android path; done means large GeoJSON updates no longer show the reported Android performance gap.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, dart, flutter
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100