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

原文地址:

https://stackoverflow.com/questions/47750922/uigraphicsimagerenderer-so-much-slower-than-uigraphicsbeginimagecontextwithoptio

添加评论

友情链接:蝴蝶教程