[Fontconfig] Application startup performance

Nick Alcock nick.alcock at oracle.com
Thu Jan 14 06:21:31 PST 2016

On 14 Jan 2016, u-pnrz at aetey.se uttered the following:

> On Wed, Jan 13, 2016 at 08:11:36PM +0000, Nick Alcock wrote:
>> On 12 Jan 2016, Keith Packard said:
>> > u-pnrz at aetey.se writes:
>> >
>> >> I would rather postulate fc-cache to be run and risk ignoring some fonts
>> >> until this is done. Is the risk really significant? Distros run fc-cache,
>> >> users who add fonts on their own would know they have to run fc-cache.
>> >
>> > Yes, it's pretty clear we've gotten distros to understand that running
>> > fc-cache is required after installing fonts.
>> However, users who add fonts on their own would definitely *not* know,
> Why? If this is documented for a year or two they really should know
> or should blame themselves.

I don't know what world you live in, but it's not the same as mine. You
cannot rely on end-users doing *anything* like that. Even the lifetime
of programs that automatically install fonts in ~/.fonts, and would
therefore have to change to run fc-cache explicitly, is many years.

>> I think automated out-of-date cache detection and cache updating must
>> stay for $HOME. It's only system fonts that are problematic for me
> Relying on $HOME is a heuristics and is unreliable, there are users who
> can not (or do not wish!) do any automatic updates there.

What, there are users who want their fonts list to be out of date? Why?

I think what you mean is 'there are users who do not want massive delays
at programs startup incurred by fontconfig cache initialization', which
I agree with -- and my prototype patch (just sent to this list, you, and
Keith) may have fixed, or at least worked around in a horrible fashion. :)

There's nothing wrong with e.g. statting the directory to determine that
a cache update is unnecessary, or doing a lot more work on the rare
occasion that an update *is* necessary -- what is wrong is doing massive
stat floods etc when an update is unnecessary. (My patch gets halfway
there -- it still readdir()s the entire directory, but at least it
doesn't stat() everything in it every time any more.)

NULL && (void)

More information about the Fontconfig mailing list