[Fontconfig] performance issue questions

L. A. Walsh fonts at tlinx.org
Tue Nov 29 11:22:06 UTC 2016


Akira TAGOH wrote:
> If your program detects duplicates updates the mtime of the 
> directories, that triggers to rebuild caches as I said earlier. that 
> isn't "nothing changed".
---
    Nothing changed that would alter functionality or require a cache 
rebuild.
The cache is rebuilt because it uses a algorithm (inspecting dir mtime) that
is known to be an inaccurate method of determining change: it triggers 
false negatives when something has reset the mtime (and change are not 
detected)
as well as triggering false positives (as in this case), when no font
data has changed.

    I was thinking the issue of duplicates.  In the past, some X servers
for windows automatically put "C:\Windows\Fonts" in the font path in 
addition
to user choices.  In my setup, it's likely that all of the fonts
in the windows font dir will be duplicated under the /usr/share/fonts
hierarchy -- both on the same machine.  Note -- I have tried to
get rid of duplicates, but they often get sprinkled back in by
various "helpful" progs...On my win machine, I see some fonts
with a hardlink count of 4... likely due to 2-copies in /usr/share/fonts
and 2 in /windows/fonts, but it's easy to see why:

 4   342124 Jun 10  2009 Microsoft Yi Baiti.ttf*
 4   342124 Jun 10  2009 msyi.ttf*
 4   356576 Jun 10  2009 Mongolian Baiti.ttf*
 4   356576 Jun 10  2009 monbaiti.ttf*
 4 14602860 jun 10  2009 microsoft yahei bold.ttf*
 4 14602860 jun 10  2009 msyhbd.ttf*
 4 21767952 jun 10  2009 microsoft yahei.ttf*
 4 21767952 jun 10  2009 msyh.ttf*

---
looking at the short names, one would have little idea what the font was
named.  Even where they are named for the internal font name, there
is inconsistency between upper and lower case names -- not a big
deal on win where the case doesn't matter, but copied
to linux, and one could have many variations in case.

Regarding Opensuse's practice of adding altnames like:


lrwxrwxrwx   1       14 Aug  6  2015 Doulos_SIL.ttf -> Doulos SIL.ttf
lrwxrwxrwx   1       14 Aug  6  2015 Droid_Sans.ttf -> Droid Sans.ttf
lrwxrwxrwx   1       14 Aug  6  2015 EVA_Hand_1.ttf -> EVA Hand 1.ttf
lrwxrwxrwx   1       14 Aug  6  2015 Eden_Mills.ttf -> Eden Mills.ttf
lrwxrwxrwx   1       14 Aug  6  2015 Embassy_BT.ttf -> Embassy BT.ttf
lrwxrwxrwx   1       14 Aug  6  2015 Fraktur_BT.ttf -> Fraktur BT.ttf
lrwxrwxrwx   1       14 Aug  6  2015 Free_Serif.ttf -> Free Serif.ttf
lrwxrwxrwx   1       14 Aug  6  2015 Gisha_Bold.ttf -> Gisha Bold.ttf
lrwxrwxrwx   1       14 Aug  6  2015 Good_Times.ttf -> Good Times.ttf
...
There are nearly 5000 of these alt-names added.

I've deleted them many times, but everytime they make any mod
to the font dir, they regenerate them.  I even modded the
prog that creates them, only to have it updated to recreate
them a year or more later.

The duplicate prob on linux is far worse than on windows with
many fonts having 12 links!

(Which is why I deduplicate them -- as, not linked, they take 19G,
linked, <7G).  I'd love to delete many of the dups now, but how long
before they are recreated?  (sigh)...

>
> Anyway, we may need to think about this again. for instance, adding an 
> API to enable/disable the cache updates automatically in fontconfig or 
> get rid of it completely and giving a responsibility to the 
> applications to do it may be good perhaps.
----
    Can I suggest using a configuration file that can specify how often
and/or when to check?

Things like 1) once/day", "once/session" (per login), "once/hour"
"every access" (like what it is now)..
2) Update DB in "background" or "foreground" (foreground is what it is 
now, with
application waiting).

Other options can be added later --




More information about the Fontconfig mailing list