[cairo] 1.1.6 to 1.2.0 performance

John Ellson ellson at research.att.com
Thu Jul 13 08:34:32 PDT 2006


James Cloos wrote:
>>>>>> "David" == David Turner <dturner at nds.com> writes:
>>>>>>             
>
> David> How on earth can you get 940 *directories* of fonts. Even the font CDs
> David> I've seen only
> David> use a dozen directories, and they're packed with hundreds if not
> David> thousands of fonts.
>
> Many out each family in its own dir, and even if not man users move
> each family into its own dir when installing, to ease the maintenance
> headaches if they do not want all font families in the search tree at
> all times.
>   
The box is a vanilla Fedora rawhide box as far as fonts are concerned.   
Its possible that the cache
mess was caused by the evolution through daily updates, but fc-cache 
should clean this up regardless.

As mentioned in previous mail,  rm -f /var/cache/fontconfig/*; fc-cache
reduces the number from 940 to 168, and a check of the strace output 
indicated that this
is from about 56 cache files being open()'ed 3 times each.
> David> I suspect some really horrible thing, like having "/usr/share"
> David> in the fontconfig search path,
>   

The directory list in  /etc/font/font.conf contains only:
    /usr/share/fonts
    /usr/share/X11/fonts/Type1
   /usr/share/X11/fonts/OTF
   ~/.fonts 
> OTOH, that is also a distinct possibility.  John, can you check that
> box for its <dir/> entries?
>
> David> but doesn't stat-ing these 940 directories is going to be
> David> a *lot* faster than memory-mapping the
> David> cache files that would be within them otherwise ?.
>
> David> I'm assuming that not all of them are going to
> David> change a lot, so a single cache in $HOME could
> David> be a performance winner.
>
> That is a good point.  I suspect you'd loose the ability to run
> fc-cat(1) to grab info about the fonts in a given dir -- something
> I got used to using the old, ascii cache files for -- but otherwise
> it does seem beneficial.
>
> -JimC
>   


IMO, there needs to be a most-recently-used, per-user cache of 
pattern->fontfile resolution.
This could be cleared on logout perhaps, or cleared by checking 
timestamps against the /var/cache/fontconfig directory

If I run a utility like dot that opens "Times-Roman" at the same 
fontsize and slant in two consecutive invocations
I don't see why it should open more that 1 cache file and 1 font file in 
the second and subsequent invocations.

John


More information about the cairo mailing list