Replies: 2 comments 3 replies
-
Oh. It is surprising that why image cache would causes this. Are encountering it when you try to load images from disk? So the bottleneck is the reading speed of the data? If so, I guess we can make a concurrent queue for reading (but not for writing, which may cause issues).
Yes, let's make it an opt-in first and see how it works. I suggest a |
Beta Was this translation helpful? Give feedback.
-
Hey, Thanks for the detailed analysis and your kind words! 🙏 You’re absolutely right about the issue with the queue blocking the static images. Switching to a concurrent queue seems like a reasonable solution to improve loading performance without any major downsides, as long as the image processing doesn’t rely on strict order or synchronization. I think it could work well, and it would be awesome if you could file a PR for this change! |
Beta Was this translation helpful? Give feedback.
-
Hey,
First of all, thanks for this awesome project 🙏
While trying to retrieve a mix of static and animating images, I noticed that the decoding of the animated images (which take about a second to load) seems to 'block' the static images from loading (which usually load instantly). After digging around in the implementation I found that the image processing operation is dispatched on a queue that is initialized here:
Kingfisher/Sources/Cache/ImageCache.swift
Line 181 in 6faf189
A
DispatchQueue
is serial by default if no parameters (other thanlabel
) are being passed in, which explains my observation of images appearing one after the other in a certain order. Changing this to a concurrent queue solves the issue for me:Can you think of any downside of using a concurrent instead of serial queue here? If not, I'd be happy to file a PR to change the queue strategy (could also be an opt-in feature of course).
Please let me know! 😁
Beta Was this translation helpful? Give feedback.
All reactions