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

WevImages in LazyVStack in ScrollView locks at 100% CPU when setting containing view to .equatable() #196

Open chrysb opened 3 years ago

chrysb commented 3 years ago

When using this pattern:

ScrollView {
  LazyVStack {
    ItemView()
      .equatable()
   }
}

And ItemView contains a WebImage, the application will lock at 100% CPU and memory will keep climbing.

Being able to use equatable is important for performance optimization and preventing views from completely re-rendering when a @State variable changes that doesn't require the view to recalculate everything.

chrysb commented 3 years ago

More information —

This doesn't happen in iOS 15 Beta 3, but it does happen in iOS 14.5.

metsfan commented 3 years ago

I posted in this issue about it as well, https://github.com/SDWebImage/SDWebImageSwiftUI/issues/186

The TLDR of it is, try running in Release mode and see if you have the same issues. In my case, I only had the bad CPU framerate issues in debug. In release, smooth as butter, low CPU usage.