[cairo] Report for the pango patch and proper profiles

Carl Worth cworth at cworth.org
Wed Nov 29 10:34:34 PST 2006


On Wed, 29 Nov 2006 16:24:03 +0200, "Xan Lopez" wrote:
> An immediate comment from the pangocairo profile: is the glyph_extents cache
> working? it's taking a lot of CPU time and we are exposing the same ~20
> characters characters all over again (this might be getting borderline
> off-topic for this list, now I think about it. If I'm bothering someone
> please just tell).

From where I stand, this is perfectly on topic, so I don't have a
problem with the discussion being here.

One thing that's tricky about performance is that a single issue can
have impacts over a large number of components, (a particular
application, many GNOME libraries, GTK+, pang, cairo, the X server,
etc.), so it can be frustrating to try to identify a single
component's mailing list as the appropriate place to discuss the
problem.

So, personally, I'm glad to accept discussion of any performance
issues that are even just tangentially related to cairo here on the
cairo mailing list, (especially if it means that the issue gets
discussed rather than no action happening on it). I think this makes
sense since we're currently focusing on performance here in cairo
land, and we can reach out to relevant X experts, etc. if they're not
already listening in here.

There's also performance-list at gnome.org. I don't know how much its
readership intersects that of cairo at cairographics.org.

> I'm attaching the profiles because I've not yet received
> the fd.o web space, sorry about it.

No worries. You did manage to fit in under the attachment size limit
this time. ;-)

And the delay in creating your account was all my fault anyway. I've
gone ahead and done that now, so hopefully you'll be all set.

As for the actual profile results, thanks for providing them. Much of
it is not surprising, (glyph measurement dominates glyph rendering
time, for example). I'll make a couple of comments by quoting only
results where an entry has an overall percentage of more than 2%.

First, we'll look at what cairo contributes:

> 453       6.1125  libcairo.so.2.10.0       __adddf3
> 413       5.5728  libcairo.so.2.10.0       _cairo_xlib_surface_show_glyphs
> 374       5.0466  libcairo.so.2.10.0       _cairo_hash_table_lookup_internal
> 323       4.3584  libcairo.so.2.10.0       _cairo_bentley_ottmann_tessellate_polygon
> 250       3.3734  libcairo.so.2.10.0       _cairo_scaled_glyph_keys_equal
> 222       2.9955  libcairo.so.2.10.0       _cairo_scaled_glyph_lookup
> 198       2.6717  libcairo.so.2.10.0       .plt
> 168       2.2669  libcairo.so.2.10.0       __aeabi_dmul

Looks like cairo itself is accounting for a little more than 25% of
the total time. The __adddf3 thing is probably pure overhead that we
can just eliminate, (maybe __eaabit_dmul as well?). Then hopefully
there's something we can do to improve cache lookup stuff,
(hash_table_lookup, scaled_glyph_keys_equal, and scaled_glyph_lookup).

If we can got those two things to disappear from the profile, then all
that's left is glyph and geometry rendering,
(xlib_surface_show_glyphs and tessellate_polygon), which is good since
that's real work that's happening, and also not a huge percentage of
the overall application time.

Next we can look at the bulk of pango and pangocairo:

> 337      20.6242  libpango-1.0.so.0.1400.5 pango_glyph_string_extents_range
> 193      11.8115  libpango-1.0.so.0.1400.5 pango_font_get_glyph_extents
> 156       9.5471  libpango-1.0.so.0.1400.5 .plt
> 66        4.0392  libpango-1.0.so.0.1400.5 pango_layout_get_extents_internal
> 59        3.6108  libpango-1.0.so.0.1400.5 pango_renderer_draw_layout_line
> 49        2.9988  libpango-1.0.so.0.1400.5 pango_renderer_get_type
[7 more pango_renderer functions in the 2-3% range, then everything
left is less than 2%]

> 484      34.6705  libpangocairo-1.0.so.0.1400.5 pango_cairo_fc_font_get_glyph_extents
> 252      18.0516  libpangocairo-1.0.so.0.1400.5 pango_cairo_renderer_draw_glyphs
> 208      14.8997  libpangocairo-1.0.so.0.1400.5 __adddf3
> 146      10.4585  libpangocairo-1.0.so.0.1400.5 __aeabi_dmul
> 81        5.8023  libpangocairo-1.0.so.0.1400.5 pango_cairo_fc_font_get_scaled_font
> 69        4.9427  libpangocairo-1.0.so.0.1400.5 .plt
> 37        2.6504  libpangocairo-1.0.so.0.1400.5 _pango_cairo_do_glyph_string
> 28        2.0057  libpangocairo-1.0.so.0.1400.5 __floatsidf

So the majority of the application time is spent measuring glyphs, not
doing any rendering. People that have spent time looking at pango
profiles before won't be surprised by that at all. I don't really have
the experience to say whether the caching is all working as designed
here, or if the design could be improved, or even how the caches are
being used at either the pango or cairo layers.

I'm hoping Behdad might have something useful to add here. I know that
pango has seen lots of optimization work, (which often means it's hard
to squeeze more performance out). But I don't know how much of that
was "before" pangocairo and whether there's some "easy" stuff to be
improved here or not.

-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/20061129/763880ed/attachment.pgp


More information about the cairo mailing list