[Fontconfig] mmap-ed caches + patch

Lubos Lunak l.lunak at suse.cz
Wed Sep 28 01:17:40 EST 2005


 Hello,

 first of all I'd like to thank for the recent work on improving fontconfig's 
performance. It's good to see this problem will be finally solved.

 However, when I tested the 2.3.90 release yesterday, I was originally 
disappointed to see it performed noticeably worse than the last stable 
version. Short version: Please apply the attached patch. Longer version: The 
problem turned out to be directories that contain files that fontconfig 
doesn't seem to use yet it analyses them (.pcf.gz files). If a directory 
contains only .pcf.gz files and has no subdirectories, then the code that the 
patch removes will not write a cache file, yet the return FcTrue means the 
directory has been successfully cached. However if you look in 
FcCacheReadDirs() you can see that if it can't use the cache file it will 
call FcDirScanConfig(). So I suggest the attached patch which will write a 
more or less empty cache file even in such directories.

 With this patch both the memory and startup time problems of fontconfig seem 
to be gone. Great :).

 And, actually, it seems I've just found another problem :(. If I run 
Konqueror, run 'fc-cache -f' and go back to Konqueror, it crashes quite soon. 
Guessing from strace of fc-cache, where I cannot see any call to unlink(), 
and from the calls to ftruncate() I assume that the new cache file contents 
are written directly in the same file instead of unlinking the old file 
first, and fontconfig doesn't survive that. As I don't understand the code 
that much I cannot confirm this theory for sure, which also means no patch 
for this, sorry :).

 Thanks

-- 
 Lubos Lunak
 KDE Developer
 l.lunak at suse.cz     l.lunak at kde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fccache.c.patch
Type: text/x-diff
Size: 386 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20050927/fe1e9042/fccache.c.bin


More information about the Fontconfig mailing list