CoreGraphics or SoftwareRenderer

I have a pretty heavy component that displays a lot of stuff, especially some complex path curves that plot very noisy data. So the rendering takes quite a lot of cpu. I have benchmarked it , rendering the full component 1000 times in a loop, using paintEntireComponent (rendering in an Image). If I let the graphics use the default coregraphics renderer, it takes 2x more cpu that when I let it use a LowLevelSoftwareGraphicsRender !

When I profile the CG version, I notice that:

  • 30 % of the time is spent in CGContextFillPath ( called by Graphics::strokePath )
  • 15 % in drawVerticalLine
  • 8% in setColour

These functions are not on the radar when using the software renderer ! I’m especially surprised by the high cost of setColour

So… my question is: what are the advantages of using the CoreGraphics renderer ? better rendering quality ? better compatibility with retina display ? or will it be faster that the software renderer if I use it on a mac with a good graphics card ?

Well you’ll get nicer fonts… Other than that, it’s hard to say because it’s impossible to know what’s going to happen under-the-hood on different machines. e.g. it’s possible that on some machines + versions of OSX it’ll use the GPU, but others may use the CPU. And even whether CPU or GPU is better will depend on the type of operation - i.e. GPUs are good when you’re doing a few big drawing operations, but if you’re drawing many small shapes, the CPU may be better.