[cairo] Cairo 1.3 performance loss

Carl Worth cworth at cworth.org
Thu Jan 25 09:06:39 PST 2007


On Wed, 24 Jan 2007 15:48:55 +0200, Jorn Baayen wrote:
> Comparing cairo 1.2.4 and 1.3.12 on ARM, a performance loss of 2% is
> observed when drawing GTK+ widgets[1]. On closer inspection, it turns
> out that the new tessellator may be to blame.
...
> [1] http://folks.o-hand.com/~jorn/cairo-benchmarks/

I see a lot of different profiles and things there. Can you guide me
through your analysis in a bit more detail? Where do you see the 2%
performance change? And where do you make a connection with the
tessellator?

> Whereas _cairo_traps_tessellate_polygon() takes up 0.17% of the overall
> system profile (1.9% in the cairo profile) in 1.2.4,
> _cairo_bentley_ottmann_tessellate_polygon() takes up 0.54% of the
> overall system profile (7.1% in the cairo profile) in 1.3.12.

Is it even meaningful at all to compare relative percentages (which is
all you get from something like oprofile) between separate runs?
At the very least you would have to normalize these numbers against
something.

I don't know the right numbers to use, but let me attempt with what
you gave me. For convenience let's invent a time unit (bogoticks) such
that the original run took 100 bogoticks. Then, if there's a
performance loss of 2% the second run took 102 bogoticks.

Now, let's look at the contribution of the tessellation calls to those
times:

Old:	0.0017 * 100 = 0.17 bogoticks
New:	0.0054 * 102 = 0.55 bogoticks

So, (if this analysis is correct), then, yeah, you can say that the
tessellator is a little more than 3 times slower. But that still
accounts for less than one third of the overall slowdown.

I'd definitely like to reduce the overhead of the new tessellator,
(particularly for simple and common shapes). What would be useful here
is to find out exactly what's being drawn when the tessellator is
getting called. Are these just rectangles?

One fairly easy way to extract the cairo calls being used is to use
Jeff's excellent libcairowrap. It's available here:

http://people.freedesktop.org/~jrmuizel/libcairowrap-0.1.tar.gz

And you can ask on this list if you have any questions about using it.

> As suggested earlier[2], I added counters to _line_segs_intersect_ceil()
> in 1.2.4 and to _cairo_bo_edge_intersect() in 1.3.12. It turns out that,
> per widget draw, _line_segs_intersect_ceil() is called 4 times, but
> _cairo_bo_edge_intersect() 7 times. Is this 75% increase according to
> expectations?

Now that is some really useful information. Thanks! Again, to start
answering the question, the first thing to do is to find out what is
being drawn so we can replicate this, (and perhaps add a cairo/perf
case that actually does report time measurements rather than just
percentages).

> I suspect that the decrease in tessellator performance is responsible
> for more than the observed 2% slowdown, as 1.3 contains many
> optimizations that are not in 1.2.

And I can't see any evidence of that. The calculations I made above
show the tessellator slowdown contributing a minor part of the overall
slowdown, and definitely not more. As for other optimizations in 1.3,
yes there are a lot of improvement, but do you know that these little
focused tests you're doing actually benefit from any?

Thanks for your help,

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20070125/12a485d8/attachment.pgp


More information about the cairo mailing list