[cairo] Performance problem with cairo / glitz

David Reveman c99drn at cs.umu.se
Mon Oct 4 07:35:32 PDT 2004


On Sun, 2004-10-03 at 17:23 +0200, Stefan Krause wrote:
> I ran the test today again and the performance of both did improve (for 
> some strange reason) from about 80 seconds to 21 seconds for cairo with 
> x11 backend and 7 seconds for the glitz backend (- which still leaves 
> room for improvements).

I just fixed a few things in glitz that caused major performance
problems on some systems. Get the new versions of glitz and cairo, and
check if performance is better.

> 
> Still I'm interested in how to improve the performace. Currently I'm 
> reselecting the font in every frame with cairo_select_font.

With the current version of cairo, that will kill performance.

>  I tried to 
> improve by using cairo_current_font once and then setting the font with 
> cairo_set_font each frame. But this crashed with more than one font. Any 
> recommendations as for high performance font handling?

Yes, that should give you OK text performance. I'll have to be a bit
careful when setting the font size, though.  Using cairo_scale_font or
cairo_transform_font will incrementally increase the font size and if
you make a call to one of those functions each frame you'll end up with
glyphs a lot larger than your memory after just a few frames. If this
seems to be the reason to why your application crashes, try setting the
font size by using cairo_font_set_transform instead.

> 
> As for the jerky zooming of the fonts I'm still looking for advice.
> 

You'll need to disable hinting. By using fontconfig and
cairo_ft_font_create to create a cairo font for a FcPattern, I think you
should be able to do this.
 
-David




More information about the cairo mailing list