FossifyOrg / Gallery

Browse your memories without any interruptions with this photo and video gallery
https://www.fossify.org
GNU General Public License v3.0
1.6k stars 53 forks source link

Allow disable fade-in of thumbnails when scrolling #136

Closed CurbedLarry closed 1 week ago

CurbedLarry commented 7 months ago

Checklist

Feature description

Allow disable fade-in of thumbnails to increase scrolling speed, reduce CPU/GPU use

Why do you want this feature?

Main issue stopping me moving on from QuickPic is sluggish scrolling of thumbnails, especially on older/slower devices. This appears to be because thumbnails fade into view from black. I assume this was an aesthetic choice and not for some other technical reason? On faster/recent devices the fade-in effect isn't that noticeable so I think it adds little value.

My hope is the effect could be made optional in the settings?

Additional information

No response

gmasil commented 7 months ago

Related: https://github.com/SimpleMobileTools/Simple-Gallery/issues/2796 My impression is that loading is actually slow, it is more apparent without the fade-in.

CurbedLarry commented 7 months ago

@gmasil Thanks for linking to the previous request.

Have noticed QuickPic is creating smaller thumbnails which surely helps. For the same ~3,000 images QuickPic has a cache of 93MB and Gallery 229MB. You really have to look closely at thumbnails with text to notice the difference on screen.

Cache size has been raised before I don't think anyone suggested a thumbnail quality setting or just reducing size/quality to benefit performance?

QuickPic QuickPic-Thumbnail Gallery Fossify-Gallery-Thumbnail

gmasil commented 7 months ago

Hi, that's a good point. I turned down the thumbnail resolution, but it didn't seem to have an impact. I started a branch here to investigate: https://github.com/gmasil/Fossify-Gallery/tree/investigate-slow-image-scrolling There is some lazy loading mechanism that I turned off and increased the prefetching of images during scrolling. Sadly this is running on the UI thread and thus introduces a stuttering UI during the eager thumbnail loading. Once all images are loaded the scrolling is very fast and smooth.

CurbedLarry commented 7 months ago

I can't help with coding but happy to test APKs.

I've tested a couple of other galleries including Aves (https://github.com/deckerst/aves/). The UI is awful and it's very slow creating thumbnails but after that it has fast pop-up of thumbnails when scrolling. It's hard to make the screen go entirely black, even when throwing the scroll bar up/down.

Can anything be learned from their code?

naveensingh commented 5 months ago

I have reduced the fade-in duration from 300ms to 150ms in version 1.1.3 but as @gmasil pointed out above, it is the image loader that needs to be optimized. Running the code on the main thread isn't helping either.

CurbedLarry commented 5 months ago

@naveensingh Thanks, I've tested the change on 4 devices and think there's a small improvement on most. On the oldest/slowest device (2015 mid-spec tablet) there's more stuttering compared to an old version of SMT Gallery.

So I can see why the delay was set quite high to help older devices. My other high-end devices from 2016-2019 are OK so hopefully most users today won't see any stuttering.

Is the image loader something that can be optimised? Do you think there's any potential boost from a smaller thumbnail size?

BluePixel4k commented 2 months ago

@naveensingh thank you for the improvement! But could you please add a setting to disable the fade-in duration completely? Thx :)

naveensingh commented 1 week ago

sluggish scrolling of thumbnails

This should be fixed in the next update. There was a (unnecessary) lazy loading mechanism that delayed loading by 100 milliseconds.

I have also conditionally disabled fade-in animation when loading from cache because it usually is instantaneous on most devices.

CurbedLarry commented 16 hours ago

Just tested v1.2.1 and loading/scrolling is so fast now! As fast as any gallery I've tested, great work!