Re: [rrd] Re: pango / fontconfig / cairo performance with rrdtool



Yesterday Behdad Esfahbod wrote:

>
>
> Tobias Oetiker wrote:
> > Behdad,
> >
> >> 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).
> >
> > I just finished modifying the code, so that I am keeping multiple
> > sets of PangoFontDescriptions for each combination of font and
> > size. I then pass the FontDescription into the text function. This
> > magically resolved the problem ... now the load_fontset gets only
> > called 3 times or so ...
> >
> > Does this match expectations ?
>
> Not really.  As I said, most probably you have been creating
> slightly-different font descriptions.  You can run the old code and print out
> the font descriptions to see what has been causing it.  In general you should
> not need to cache much to make Pango behave.  Just use the default font map
> (which you are) and it should work reasonably.

Hmm,

I am using the same font name across the board in 4 different sizes.

DejaVu Sans Mono,Bitstream Vera Sans Mono,monospace,Courier 7
DejaVu Sans Mono,Bitstream Vera Sans Mono,monospace,Courier 8
DejaVu Sans Mono,Bitstream Vera Sans Mono,monospace,Courier 9
DejaVu Sans Mono,Bitstream Vera Sans Mono,monospace,Courier 5.5

Is there a way to figure what font pango picked based on my
description and then tell it to use this one again ?

Could it be that when I ask for font

"ABC,CCD 9"

that pango finds

"CCD 8.99999"

and then when I ask again for

"ABC,CCD 9"

it goes looking again ?

Could it be that I am doing something that makes pango forget about
the fonts (flush its cache).

How should I be structuring my program for optimal results.
Have a separate layout for each font I am going to use and then
switch layout according to the font ?

As I said, I have shuffled my code around and suddenly the time
for generating a second graph has gone down dramatically. I just
don't know exactly why.

old code:
0.221
0.158
0.152
0.157

shuffled code with separate PangoFontDescription structures for
each font/size which I then apply to the layout as required:
0.194
0.024
0.023
0.023

rrd 1.2 code with libart/freetype:
0.031
0.024
0.023
0.024


cheers
tobi




> behdad
>
> > cheers
> > tobi
> >
> >
> >
>
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi oetiker ch ++41 62 775 9902 / sb: -9900


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]