ImageFrameworksBenchmark icon indicating copy to clipboard operation
ImageFrameworksBenchmark copied to clipboard

Image Frameworks Benchmark

Updated on May 23, 2021

Only comparing Swift frameworks and SDWebImage as an exception because it's still actively maintained and often used even today.

Main Thread Performance

Image loading frameworks are often used in table and collection views with a large number of cells. They must perform well to achieve smooth scrolling. This benchmark tests method that are used on the main thread.

Nuke.loadImage(with: url, into: view)
view.kf.setImage(with: url)
view.sd_setImage(with: url)
view.af.setImage(withURL: url)

The results (higher is better):

  • The reason AlamofireImage is so slow is that it's creating URLRequest instances and attaching HTTP headers on the main thread, which is expensive and not needed for memory cache lookup
  • Kingfisher performs disk reads on the main thread