New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image decoding/decompression still happening on the main thread #63
Comments
Hmm, yeah I can definitely get that. I'll do it tomorrow. One thing is these |
It looks like a tick of a CADisplayLink timer is creating a Core Animation transaction that's kicking this off. I've not used SwiftUI, but in UIKit terms, I suspect the frame the view is being set to a size that does not match the underlying image that has been downloaded (and a contentMode of "fit"). Maybe you can set a breakpoint in |
Hmm, there is no real setFrame equivalent, but I just tried replacing private struct _UIImageView: UIViewRepresentable {
private let image: UIImage
init(image: UIImage) {
self.image = image
}
func makeUIView(context: Context) -> UIImageView {
return UIImageView()
}
func updateUIView(_ uiView: UIImageView, context: Context) {
uiView.image = image
}
typealias UIViewType = UIImageView
} |
Describe the bug
Even though there exists code in TIP to decode the image on the background thread, apple is still decoding the image again on the main thread. Seems some recent change caused the decoding in TIP to not function.
To Reproduce
Load remote images under profiler and do a filter for jpeg.
Expected behavior
Images are decompressed only on background thread.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
iOS 14 (coworker claims it happens on iOS 13 as well)
Additional context
So there are 2 weird things:
I'll create a PR soon, need to get more familiar with the code and what is best practice for decoding images off the main thread. Wanted to create the issue now to increase awareness for those that are more familiar with this code.
The text was updated successfully, but these errors were encountered: