damus icon indicating copy to clipboard operation
damus copied to clipboard

Fix frequent Kingfisher hang and other scrolling improvements

Open OlegAba opened this issue 2 years ago • 2 comments

This PR should, hopefully, fix the hang that many users have been experiencing related to Kingfisher Ref: note13j4kv0qc6eju03yc58kqhd00tuekc68z6pz8tk8y8y55l92c5rdslf9mw8

I believe the hang is caused when many images are queued for download from scrolling quickly; too many callbacks on the main thread at once, or network blocking? cancelOnDisappear will help for this.

According to KF docs line 98-101, backgroundDecode will also help eliminate scrolling hitches. IMPORTANT: If used, this option will have a significant impact on memory when downloading images. Older devices will crash while loading large files, even with a downsampler. If we decide to use this option, I recommend we implement #335 first.

Removed fade and loadDiskFileSynchronously as it impacts performance and doesn't make a noticeable UX difference.

Instruments Tests

Ran the following flow before and after changes

Results Before (Contains KFImage.ImageBinder hang)

before

Results After (Less frequent and shorter delays in hangs/hitches)

after

OlegAba avatar Feb 15 '23 04:02 OlegAba

let's get #335 rebased and I'll merge these at the same time

jb55 avatar Feb 15 '23 16:02 jb55

this is huge, thank you. will test

jb55 avatar Feb 15 '23 16:02 jb55

merged this! let's merge 335 next

jb55 avatar Feb 15 '23 19:02 jb55