[Bug]: Gifs are laggy
Speedy native Discord client for macOS built in Swift
Brought to you by:
cryptoalgo
Originally created by: Im-Fran
Bug Description
The gifs that are shown are laggy, and even more when viewing a folder.
0.5.1 (Build 15)
Media (images, audio, video etc.)
No response
This is from Official Discord:
This is from SwiftCord
No response
Originally posted by: cryptoAlgorithm
This appears to be yet another issue related to SwiftyGif not being so swifty after all. I might have to implement a more performant implementation using CoreGraphics directly.
Originally posted by: ErrorErrorError
@cryptoAlgorithm you could consider using Nuke which does simplify a lot of the image loading if that's something you don't want to reimplement from scratch.
Originally posted by: cryptoAlgorithm
@ErrorErrorError That's interesting, it like a good alternative to replace both
CachedAsyncImage
andSwiftyGif
🤔. And it even has first-class SwiftUI support. I will consider refactoring with Nuke in a PR to evaluate its advantages soon.Originally posted by: cryptoAlgorithm
@ErrorErrorError I dug deeper and it appears that we are back with the same issues as before. Nuke is a performant image loading solution, but out of the box it does not support rendering animated GIFs (or any other format not natively supported by the system). I'll have to integrate it with another library which actually renders GIFs, and the bottleneck we're facing resides in this rendering library.
It's a bit of a bummer, but I might still consider migrating to Nuke from
CachedAsyncImage
as it appears to have better caching and loading heuristics.Originally posted by: cryptoAlgorithm
After throwing together some quick code to use Nuke instead of
CachedAsyncImage
to evaluate its suitability, I have come to the conclusion that migration isn't worth it as it actually leads to (very noticeably) worse scrolling performance, albeit with slightly better caching (and so lower network activity). I feel that scrolling performance impacts virtually all users, so saving a few kBs of network activity is not worth it for the significant scroll jank.