-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
perf(mobile): remove load of thumbnails in the image provider #17773
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
perf(mobile): remove load of thumbnails in the image provider #17773
Conversation
* Removed the load of the thumbnail from the local and remote image provider as they shall provide the image, not the thumbnail. The thumbnail gets provided by the thumbnail provider. * The thumbnail provider is used as the loadingBuilder and the image provider as the imageProvider. Therefore loading the thumbnail in the image provider loads it a second time which is completely redundant, uses precious time and yields no results.
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.
Great improvement! Thank you
While you are at it? What device do you use for testing? Android? iPhone?
There is a strange issue on iPhone 15 and below and iPad that sometimes it takes 2 swipes to navigate to the next/prev assets. On iPad I can reliably reproduce this when the iPad is in vertical orientation, and the photo has vertical display, it will always takes 2 swipes
Do you have any thoughts?
That sounds weird. Is this behavior only appearing with these changes? |
AFAIK, The double swipe issue is more prominent on iOS. I couldn't reproduce it as well on my iPhone 15P. If you're on Discord, send me a message there. I can help you with deploying the app onto your iPad. |
No, this has been a long-standing issue |
Regarding the double swipe I found an interesting behavior while testing something else on an emulated android. After adding two logs I took a quick video, is that behavior equal to the one you two are describing? DoubleSwipe_compressed.mp4Edit: The underlying issue seems to be a missing |
@EinToni Yeah that looks very much like it. Not sure if it is more prominent on some phone models |
I moved it into #6249 to discuss it further there. |
Remove loading of thumbnail in the image provider * Removed the load of the thumbnail from the local and remote image provider as they shall provide the image, not the thumbnail. The thumbnail gets provided by the thumbnail provider. * The thumbnail provider is used as the loadingBuilder and the image provider as the imageProvider. Therefore loading the thumbnail in the image provider loads it a second time which is completely redundant, uses precious time and yields no results. Co-authored-by: Alex <[email protected]>
…-app#17773) Remove loading of thumbnail in the image provider * Removed the load of the thumbnail from the local and remote image provider as they shall provide the image, not the thumbnail. The thumbnail gets provided by the thumbnail provider. * The thumbnail provider is used as the loadingBuilder and the image provider as the imageProvider. Therefore loading the thumbnail in the image provider loads it a second time which is completely redundant, uses precious time and yields no results. Co-authored-by: Alex <[email protected]>
Description
There is no need to load the thumbnail in the immich_*_image_provider before the image is loaded.
In the
gallery_viewer
, the loadingBuilder of thePopScope
is anImmichThumbnail
and therefore already loads the (cached) thumbnail. After that is loaded, the actual imageProviderImmichImage
is invoked which then loads and displays the actual image. Loading the thumbnail again in the imageProviderImmichImage
is redundant and just slows things down without the user actually seeing any difference as it loads the same thing.Therefore I did the following changes:
This is a follow up of #17682
How Has This Been Tested?
It can be tested by normal usage to feel a slightly faster load.
To actually verify that these changes are valid and the extra load of the thumbnail in the image provider is unnecessary I suggest the following:
immich_remote_image_provider
andimmich_local_image_provider
input a sleep at the top of the_codec
method:await Future.delayed(const Duration(seconds: 2))
Checklist:
src/services/
uses repositories implementations for database calls, filesystem operations, etc.src/repositories/
is pretty basic/simple and does not have any immich specific logic (that belongs insrc/services/
)