[rrd-developers] pango / fontconfig / cairo performance with rrdtool

Behdad Esfahbod behdad at behdad.org
Sun Aug 31 23:08:24 CEST 2008


Tobias Oetiker wrote:
> Wizards,
> 
> A few months back I ported rrdtool (www.rrdtool.org) over from
> libart/freetype to cairo/pango. It all went quite well and the
> resulting graphs look cool. But when it comes to performance things
> look realy bad.
> 
> Creating a little test graph with rrdtool 1.2 (libart/freetype)
> takes about 0.01s while the same graph with (cairo/pango) takes
> 0.2s in other words, I am seeing a 20 times slow down. Creating
> several graphs in the same session does not change things much.
> 
> I have sat down with callgrind to analyze and found that 80% of the
> time is spend in the
> 
>   pango_font_map_load_fontset
> 
> function. I bet I am doing something terribly wrong here, since I
> use the same font in only 2 sizes all over the graph.
> 
> I have based my code on the example in the documentation
> http://developer.gimp.org/api/2.0/pango/pango-Cairo-Rendering.html#rotated-example
> but maybe this is not optimal. I tried to add some caching but it
> did not help much.
> 
> I have put a few details up on
> 
>   http://tobi.oetiker.ch/rrd_pango/
> 
> any ideas ?

Hi Tobias,

The part creating the layout looks good.  Any *interesting* thing will be
hidden in other parts of the code, namely the code calling this function.  In
general I'm quite surprised that you are hitting the load_fontset() path all
the time as the fontsets should be cached and simply reused.  One way to debug
it is to run with FC_DEBUG=1 and look for all different Sort Patterns passed
to fontconfig and see how they differ (I'm guessing minor difference in the size).


behdad

> cheers
> tobi
> 
> 



More information about the rrd-developers mailing list