UIGraphicsImageRenderer so much slower than UIGraphicsBeginImageContextWithOption


I came across quite an odd issue. When testing my code to create a UIImage I found that using UIGraphicsImageRenderer was so much slower than when using UIGraphicsBeginImageContextWithOption.

When drawing 5 large images I found using UIGraphicsBeginImageContextWithOption would render it in 0.3 seconds while using UIGraphicsImageRenderer would render the images in 13.3 seconds.

When testing the two environments for drawing 500 UIBezierPath rects UIGraphicsBeginImageContextWithOption was still faster but not by much.

This was a big surprise, as I thought UIGraphicsImageRenderer was meant to be the new technology to be adopted and is much more efficient than the older UIGraphicsBeginImageContextWithOption way of creating a UIImage.

I have creates a project to show this and have posted it on GitHub here

Any ideas why?


Latest code is missing in the repo



Add a Comment