SDWebImage / SDWebImageSwiftUI

SwiftUI Image loading and Animation framework powered by SDWebImage
https://sdwebimage.github.io/SDWebImageSwiftUI
MIT License
2.14k stars 219 forks source link

How to improve performance ? #186

Open brightfuture opened 3 years ago

brightfuture commented 3 years ago

i have about 20 WebImage in a lazy vgrid now the app janks a lot when scrolling i instrumented it and it shows WebImage was taking very long to draw

so is there a way to improve the performance ?

leogiroux commented 3 years ago

I have exactly the same question :)

Is there a way to reduce the resolution of the image displayed ?

brightfuture commented 3 years ago

@leogiroux i have cropped images to small size, and yet the issue is still there i think the problem is each WebImage has its own network module which is against SwiftUI's design principle to keep views light

i might have to eventually ditch this framework and just use Image instead

Cyclic commented 3 years ago

"janks a lot" 🤣 I hope you made this up, because I'm stealing it. And I was just talking about this with a buddy. It would be nice if this library was updated to use the new Swift Concurrency features, it would be so smooth, @dreampiggy! There are a lot of things that the new AsyncImage cannot do, so it would be great if this library wrapped it.

metsfan commented 3 years ago

I'm just going to put out there that I was having this exact same issue. I have 2 LazyHGrids and 1 LazyVGrid on the same screen all loading images. I was getting a horrible framerate and CPU pegged at 100%. Decided to make a Release build to see what the performance would be like in production. Smooth as butter, CPU sitting at around 2-3% unless the user is scrolling, but it never goes above 50%. So this seems to be a Debug-mode related issue with LazyV/HGrid and likely has nothign to do with SDWebImage