News for hackers. Stuff that matters.
Re:Layer Trees vs. Flat Drawing: Graphics Performance Across... by Zev on Friday May 24, 2013 @06:58PM (#5765687)
It wasn't mentioned in the article, but, it is very important to note: CAGradientLayer is not GPU-backed.

In other words, the comparison is between the CPU redrawing a gradient 60x a second, and, an image being moved around on screen. Not entirely surprising that the one that does less rendering is going to be faster.

Re:Layer Trees vs. Flat Drawing: Graphics Performance Across... by panic on Saturday May 25, 2013 @05:17AM (#5766774)
CAGradientLayer is absolutely GPU-backed. Your colors and locations are drawn into a 1-D texture and stretched on the GPU.
Re:Layer Trees vs. Flat Drawing: Graphics Performance Across... by ryanpetrich on Friday May 24, 2013 @07:45PM (#5765818)
Yes, one should always set shouldRasterize on CAGradientLayers (or at least those that aren't in a parent that has shouldRasterize)
Re:Layer Trees vs. Flat Drawing: Graphics Performance Across... by Zev on Friday May 24, 2013 @09:13PM (#5766014)
Saying "Always rasterize" isn't necessarily the solution, either. Its actually pretty bad advice to follow all the time ;)

I suspect (but can't confirm without the source code to the demo) that shouldRasterize would actually hurt performance in one of the two cases in the article. Specifically, I imagine that it would make the score for adding and removing views from screen even worse than it already is.

Yes, it renders into a bitmap, and reduces CPU usage, once you've paid the upfront rendering cost. But, it doesn't rasterize opacity, and, will use up a ton of memory (because it doesn't result in stretchable images).