[Fontconfig] fontconfig matching speedup

Brian Ryner bryner at brianryner.com
Tue Aug 24 05:23:15 EST 2004


I wanted to get some feedback on a fontconfig patch I've been working on to
speed up FcFontMatch(). (I noticed it taking a good chunk of time during Mozilla
page layout).

The idea is to optimize the case where we have one or more fonts that are an
exact match for the family given in the pattern.  All of the patterns in a
fontset are put into a hash table that is keyed on the family.  Of course, since
there will be more than one pattern for each family (slant/weight variations),
the hash entries are linked lists of patterns.  Assuming that the pattern passed
in to FcFontMatch doesn't specify any higher-priority values than family, the
hash table lookup can quickly reduce the number of patterns you need to compare
against, usually to just a handful.  If there's no exact match, it falls back to
the existing matching code.

The biggest question for me is whether this will always produce the same results
as the slower matching code.  I think that it will, but any suggestions would be
great, particularly regarding testing.


-Brian Ryner
bryner at brianryner.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fontconfig-20040822.diff
Type: text/x-patch
Size: 11000 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20040823/55d0b35b/fontconfig-20040822.bin

More information about the Fontconfig mailing list