Question

SDWebImage claims that AFNetworking doesn't cache the image itself but just the HTTP response, so SDWebImage is faster in recalling the image from cache and presenting it.

If I wanted to use purely AFNetworking, is such a claim, true or not, really something that is noticeable performance-wise? Is it something I should be wary of?

Was it helpful?

Solution

SDWebImage has much more control over image caching. It can cache to disk or memory.

AFNetworking relies on NSURLCache to persist images between app launches (and it's not very reliable), but it's great if you just need to cache during one run.

Both solutions cache a UIImage object in memory during the lifetime of the app. This is important because caching the NSData representation isn't fast enough to load images smoothly when scrolling through a table view.

Summary: AFNetworking's solution is simpler and will work for most use cases. If you need finer control, or disk caching, use SDWebImage instead of modifying AFNetworking's implementation.

OTHER TIPS

It's not true.

If you look at the code, you can see that the category UIImageView+AFNetworking cache the UIImage (using NSCache and the urlRequest as the key). The cache isn't written to disk though.

I have used both :

SDWebImage is much much faster then UIImage + AFNetworking .

In UITableViewCell you can see the significant difference in performance . It was taking a hell lot of time in AFNetworking and the code is also too long . SDWebImage is much faster and short .

Use SDWebImage for better Image performance .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top