[cairo] Cairo traces for analysis: hints on improving performance?

Chris Wilson chris at chris-wilson.co.uk
Fri Oct 17 05:01:56 PDT 2014

On Fri, Oct 17, 2014 at 01:12:22PM +0200, Oliver Kaleske wrote:
> Dear Cairo experts,
> my team and I are currently exploring the use of either Cairo or Skia as a replacement for an older graphics backend in one of our products. In terms of image quality, we're quite content with the present results using either engine. However, performance is crucial, and in this respect the results are not quite satisfactory yet. At the current stage of our analysis, Skia appears to be quite a bit faster for our purposes. (We are aware of the Caskbench test suite and the results published by Samsung, but we need specific results for our use case.)
> The Cairo FAQ invites users to provide a cairo-trace. I hope that this offer still stands and would appreciate it very much if some of you cared to take a look at our traces which are available at https://ptvbox.ptvgroup.com/public.php?service=files&t=9ac2aabdb5a4bfeb6a82d7d9b00baa52 (a dropbox-ish public folder) and share your insights. It may well be that we are using Cairo in a terribly inefficient way; after all, we're still pretty new to it.
> Some background info: Our key use case is map rendering. The traces therefore correspond to rendering a few different map sections; labels are currently left out for simplicity. You may notice that there are paths which never get rendered because they are off-image. This does cost some performance, but the same data is provided to Cairo and Skia, so both have to struggle equally.
> In the output, you will also notice artifacts resulting from tiled input data. If this is a common issue with a standard solution (like choosing a different drawing operator), a hint would be appreciated; but this is currently not our main concern as we're confident to resolve it one way or another.
> As written above, performance results to date favour Skia (for our application). On the other hand, we prefer Cairo when it comes to API complexity, documentation, build and integration efforts, so any feedback that will help us improve Cairo's performance is welcome. The traces provided should present sufficiently typical examples of our use case.
> Legal remark: the map data contains copyrighted material and may only be used for the performance analysis in question. (See __LEGAL.txt in the shared folder for details.)
> Best regards and thanks in advance

If you use perf/cairo-analyse-trace that will outline where the time is
spent. The biggest single impact seems to be from using ROUND line caps.
Otherwise, all the time is spent in rasterising the strokes and the
paths / operations are simple enough to hit the preferred paths, so all
that remains is optimise those paths more. Most of the time is spent,
perhaps not unsurprisingly, inside the rasteriser with paper cuts

Chris Wilson, Intel Open Source Technology Centre

More information about the cairo mailing list