[Fontconfig] Application startup performance

Akira TAGOH akira at tagoh.org
Wed Jan 13 18:29:33 PST 2016


On Wed, Jan 13, 2016 at 8:16 PM,  <u-pnrz at aetey.se> wrote:
> Thanks for the explanation Akira. As for checking cache consistency,
> I'd rather prefer the applications blindly trust the caches, not check.
>
> IIUC we have though a contract about the possibility to update font
> files without updating the caches at the same time :( It would take
> time to gradually remove this contract without breaking too much for the
> users. On the other side, stating this as obsoleted in the documentation
> and putting the deadline for removal in a year would be fair, wouldn't it?
>
> Then everyone would know: you add a font file? let you run fc-cache.

We could try to add a boolean flag to the configuration for
enabling/disabiling that check at the runtime though. we definitely
need to test it carefully if it doesn't affect a lot. or only if the
font directory is on nfs.

> Not sure why the generation would have to be done in advance?

Because fontconfig on running applications will tries to update the
cache when it is detected.

> If the cache files are being replaced atomically, they only become
> inconsistent if a font file has been removed. Otherwise, applications
> at rescan notice new caches and hence the added fonts as well,
> everything remains fine all the time. Or do I miss something?

Depends. if fonts has critical changes (e.g. urw-fonts removed
Cyrillic glyphs from Century Scroolbook L) or renaming family name
etc, you'll see inconsistency between caches and fonts.

> Honestly, even though the former behaviour (dir-stat() only) worked
> reasonably well in usual scenarios, the runtime cache building attempts
> by applications in certain situations are frustrating to say the least (!)
> when it implies fetching zillions of files over the network, pushing other
> more valuable files out of the cache, without any good reason, because
> 99.9% of this data is not going to be used. Runtime cache building
> is IMHO also confusing and misleading for the users and the
> administrators, given the presence of fc-cache as a separate tool
> "for this very purpose".

That said, from that purpose, it has to be available before actually
use. there are no way to know in advance what fonts are actually being
used. To get rid of the runtime cache generation, we need to have any
way to ensure that caches keeps up-to-date when fonts is
installed/updated.

-- 
Akira TAGOH


More information about the Fontconfig mailing list