-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
feat(mobile): drift map page #19898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(mobile): drift map page #19898
Conversation
Testing with an instance of 80,000+ assets, it triggered an error while I am moving around the map. Below is the logs
While loading, the map is quite janky, fps drops significantly |
You can assign the bounds as the key to the Timeline widget and it should reload whenever the bounds are updated |
LatLngBounds bounds, { | ||
GroupAssetsBy groupBy = GroupAssetsBy.day, | ||
}) { | ||
if (groupBy == GroupAssetsBy.none) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably remove this condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot understand. Can you explain the meaning?
Which instance do you use to test? I tested on my stress test instance and moving around the map is very janky, in production build |
98a0be0
to
91dbe29
Compare
I test in https://main.preview.internal.immich.cloud. Would you mind provide an instance for me? I don't have so many assets in my server. I think removing layers, adding sources and add layers is the cause, so I try to optimize it. |
I can't unfortunately, it is a clone of my personal instance |
Ok, I will optimize first, and then you can test and give feedback. |
mobile/lib/presentation/widgets/bottom_sheet/map_bottom_sheet.widget.dart
Outdated
Show resolved
Hide resolved
91dbe29
to
c958009
Compare
@alextran1502 Can you test in release mode again? I think the performance issue has been solved. |
mobile/lib/presentation/widgets/bottom_sheet/map_bottom_sheet.widget.dart
Outdated
Show resolved
Hide resolved
mobile/lib/presentation/widgets/bottom_sheet/map_bottom_sheet.widget.dart
Outdated
Show resolved
Hide resolved
final bounds = ref.watch(mapStateProvider.select((s) => s.bounds)); | ||
AsyncValue<Map<String, dynamic>> markers = | ||
ref.watch(mapMarkerProvider(bounds)); | ||
AsyncValue<Map<String, dynamic>> allMarkers = | ||
ref.watch(mapMarkerProvider(null)); | ||
|
||
ref.listen(mapStateProvider, (previous, next) async { | ||
markers = ref.watch(mapMarkerProvider(bounds)); | ||
}); | ||
|
||
markers.whenData((markers) => reloadMarkers(markers)); | ||
allMarkers | ||
.whenData((markers) => reloadMarkers(markers, isLoadAllMarkers: true)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These could actually be part of the parent widget and we could remove this private widget all together. It feels weird to return the bottom sheet widget from a widget called _Markers
.
Also, why'd we have two different marker providers? Is the idea to load only those displayed in the current bounds until all the markers for the maps are loaded, after which, we don't make any more marker updates? If so, the current code is a bit incorrect in the sense that it still makes redundant DB calls whenever the bounds are updated, but the results are ignored after loadAllMarkers
is set to true
You can refactor all this logic into a single provider and address all these issues more efficiently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, if you move the map, the markers in the bounds will be loaded. At the same time, all markers will be preloaded. When all the markers are loaded, we don't need to load or filter markers any more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, if you move the map, the markers in the bounds will be loaded. At the same time, all markers will be preloaded. When all the markers are loaded, we don't need to load or filter markers any more.
Yeah, we can do this in a single provider and make things simpler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have deleted redundant DB calls. Let's see the performance. And then refactor it.
7905afe
to
55883c6
Compare
Hello, another round of testing. I see the improvement, I can move the map around, zoom in and out. However, the framerate is still relatively low and janky. I think there are still some bottle neck of there might be place we can debounce better |
Can you record the stack by android and flutter profile tool and provide me with flame chart? I want to confirm if it is a rendering issue with OpenGL because now we do not have any db calls and markers reload. |
We need to refactor timeline and bottom sheet to display timeline in the bottom sheet.There is much higher efficiency than previous map widget.