[Fontconfig] performance optimizations

Owen Taylor otaylor at redhat.com
Wed Oct 13 22:59:22 EST 2004


On Tue, 2004-10-12 at 14:34 -0700, Keith Packard wrote:

> I'm actually wondering how well we could do if we were closer to the CSS 
> font matching spec; that might permit a heirarchical database split across 
> family/style/size boundaries which could reduce the search space for a 
> particular pattern.  Converting the unsorted search to one which can use a 
> sorted (or hashed) set of family names should make things a lot faster.  

Well, that's certainly how Pango works - pango_font_family_list_faces(),
pango_font_face_list_sizes(). An internal organization on this would
help FcFontMatch a lot, but as far as I can see, isn't going to be
any use for FcFontSort.

> And, using some kind of canonical string set and pointer compares would 
> eliminate all calls to strcmp past the API.
> 
> > That's partly because common toolkits (Pango and I think also Qt) have
> > higher levels of caching above fontconfig.
> 
> Which would be nice to eliminate somehow; duplicating the font data in yet
> another format is not helping performance here.  Not that the current
> fontconfig format is useful for Pango, but perhaps we could design
> something as a replacement for all three systems (Pango, Qt and
> fontconfig).

The big thing that needs to be cached in Pango is actually FcFontSort()
results ... there are some performance problems with the Pango font
iteration APIs currently due to the slowness of FcFontMatch() but that's
really peripheral. 

I'm not sure how to get around caching FcFontSort results - it's pretty
much inherently a slow operation. What would help a *lot* in reducing
the size of that cache would be to finesse BDF/PCF fonts in some way
and make the FcFontSort results independent of pixel size. Not that
I have any good idea for how to do that.

Regards,
						Owen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20041013/88a614fe/attachment.pgp


More information about the Fontconfig mailing list