[Fontconfig] severe performance regression when global fonts.cache-2 files are missing

Mike FABIAN mfabian at suse.de
Fri Oct 21 02:36:44 EST 2005


Tested with a CVS snapshot of the fontconfig 2.4 branch from
yesterday.

I noticed that if the global fonts.cache-2 files are out of date,
applications using fontconfig take a long time to start.

I understand that this happens once because the user cache file
~/.fonts.cache-2 has to be generated. But if this file has been
generated, subsequently called applications should start fast.

With the current fontconfig, the slowness doesn't go away.

To reduce the problem to a simple test case, I deleted all
global fonts.cache-2 files and then tried the following:

mfabian at magellan:~$ time fc-list "Luxi Sans" ; ls -l --time-style=full-iso .fonts.cache-2
Luxi Sans:style=Bold
Luxi Sans:style=Regular
Luxi Sans:style=Oblique
Luxi Sans:style=Bold Oblique

real	2m18.368s
user	0m52.559s
sys	0m2.780s
-rw-------  1 mfabian suse 4515026 2005-10-20 18:23:33.000000000 +0200 .fonts.cache-2
mfabian at magellan:~$ time fc-list "Luxi Sans" ; ls -l --time-style=full-iso .fonts.cache-2
Luxi Sans:style=Bold
Luxi Sans:style=Regular
Luxi Sans:style=Oblique
Luxi Sans:style=Bold Oblique

real	0m5.154s
user	0m1.200s
sys	0m0.208s
-rw-------  1 mfabian suse 45890 2005-10-20 18:25:00.000000000 +0200 .fonts.cache-2
mfabian at magellan:~$ time fc-list "Luxi Sans" ; ls -l --time-style=full-iso .fonts.cache-2
Luxi Sans:style=Bold
Luxi Sans:style=Regular
Luxi Sans:style=Oblique
Luxi Sans:style=Bold Oblique

real	2m13.954s
user	0m53.459s
sys	0m3.244s
-rw-------  1 mfabian suse 4515026 2005-10-20 18:27:38.000000000 +0200 .fonts.cache-2
mfabian at magellan:~$ time fc-list "Luxi Sans" ; ls -l --time-style=full-iso .fonts.cache-2
Luxi Sans:style=Bold
Luxi Sans:style=Regular
Luxi Sans:style=Oblique
Luxi Sans:style=Bold Oblique

real	0m4.074s
user	0m1.220s
sys	0m0.196s
-rw-------  1 mfabian suse 45890 2005-10-20 18:28:30.000000000 +0200 .fonts.cache-2
mfabian at magellan:~$ 

You see that the first invocation of "fc-list" is slow and generates
a 4.5 MB ~/.fonts.cache-2 file.

The next invocation of "fc-list" is fast but surprisingly changes
the ~/.fonts.cache-2 again and reduces it to a size of only 45 KB.
This cannot be correct. The next invocation of "fc-list" is slow
again and regenerates the 4.5 MB ~/.fonts.cache-2 file again.

I.e. every second invocation of "fc-list" is fast but apparently
destroys the ~/.fonts.cache-2 file.

-- 
Mike FABIAN   <mfabian at suse.de>   http://www.suse.de/~mfabian
睡眠不足はいい仕事の敵だ。




More information about the Fontconfig mailing list