[Fontconfig] Application startup performance
Behdad Esfahbod
behdad at behdad.org
Mon Jan 11 08:34:29 PST 2016
On 16-01-11 04:28 PM, Behdad Esfahbod wrote:
> On 16-01-11 03:30 PM, Keith Packard wrote:
>> Behdad Esfahbod <behdad.esfahbod at gmail.com> writes:
>>
>>> Humm. I don't know when things changed, but as far as I understand, we
>>> readdir() every time; the cache just caches the patterns for each
>>> file.
>>
>> That's wrong -- fontconfig knows all of the directories in the hierarchy
>> and should be able to just stat each of them; if none of the existing
>> directories have changed, then no new fonts could have been added to the
>> system. Stat'ing a few known directories should suffice to track whether
>> the cache is up to date. And, it used to work this way, so something has
>> been broken.
>
> Right. Seems to be introduced by the never-ending series of "fix race
> condition" patches. In particular:
>
> commit f44bfad235e63bb792c38e16ae1fbd281ec1453b
> Author: Akira TAGOH <akira at tagoh.org>
> Date: Thu Jun 5 19:06:02 2014 +0900
>
> Workaround another race condition issue
>
> See https://bugzilla.redhat.com/show_bug.cgi?id=921706
Akira,
Do you remember what the issue actually was? Neither the commit log nor the
bug history really mention that!
b
> Here's the stacktrace:
>
> #0 FcStat (file=0x626710 "/home/behdad/.fonts/ArabicSansBY-Regular.otf",
> statb=statb at entry=0x7fffffffcd60) at fcstat.c:127
> #1 0x00007ffff7ba7e3f in IA__FcFileIsDir (file=<optimized out>) at fcdir.c:36
> #2 0x00007ffff7ba84a1 in FcDirScanConfig (set=0x0, dirs=0x625a80,
> blanks=<optimized out>, dir=<optimized out>, force=<optimized out>,
> config=0x603040, scanOnly=1) at fcdir.c:309
> #3 0x00007ffff7ba85c3 in FcDirScanOnly (dirs=dirs at entry=0x625a80,
> dir=dir at entry=0x609390 "/home/behdad/.fonts",
> config=config at entry=0x603040) at fcdir.c:348
> #4 0x00007ffff7b9f316 in FcCacheDirsValid (config=config at entry=0x603040,
> cache=cache at entry=0x7ffff7f9d000) at fccache.c:604
> #5 0x00007ffff7b9fd1d in FcDirCacheMapFd (config=config at entry=0x603040,
> fd=fd at entry=3, fd_stat=fd_stat at entry=0x7fffffffcf40,
> dir_stat=dir_stat at entry=0x7fffffffcfd0) at fccache.c:684
> #6 0x00007ffff7b9fd69 in FcDirCacheMapHelper (config=config at entry=0x603040,
> fd=fd at entry=3, fd_stat=fd_stat at entry=0x7fffffffcf40,
> dir_stat=dir_stat at entry=0x7fffffffcfd0,
> closure=closure at entry=0x7fffffffd0e8) at fccache.c:725
> #7 0x00007ffff7b9f788 in FcDirCacheProcess (config=config at entry=0x603040,
> dir=<optimized out>,
> callback=callback at entry=0x7ffff7b9fd60 <FcDirCacheMapHelper>,
> closure=closure at entry=0x7fffffffd0e8,
> cache_file_ret=cache_file_ret at entry=0x0) at fccache.c:224
> #8 0x00007ffff7b9feaa in IA__FcDirCacheLoad (dir=<optimized out>,
> config=config at entry=0x603040, cache_file=cache_file at entry=0x0)
> at fccache.c:738
> #9 0x00007ffff7ba88a2 in IA__FcDirCacheRead (
> dir=dir at entry=0x607040 "/home/behdad/.fonts", force=force at entry=0,
> config=config at entry=0x603040) at fcdir.c:477
> #10 0x00007ffff7ba3e9b in FcConfigAddDirList (config=config at entry=0x603040,
> set=set at entry=FcSetSystem, dirSet=0x603150) at fccfg.c:380
> #11 0x00007ffff7ba3f4b in IA__FcConfigBuildFonts (
> config=config at entry=0x603040) at fccfg.c:413
> #12 0x00007ffff7bad536 in FcInitLoadOwnConfigAndFonts (config=0x603040,
> config at entry=0x0) at fcinit.c:163
> #13 0x00007ffff7bad567 in IA__FcInitLoadConfigAndFonts () at fcinit.c:174
> #14 0x00007ffff7ba16e7 in FcConfigEnsure () at fccfg.c:46
>
>
> The cache is due for a rewrite, though I have no idea where to start or who
> should do it.
>
> b
>
--
behdad
http://behdad.org/
More information about the Fontconfig
mailing list