[Fontconfig] Fontconfig performance question.

Krzysztof Dabrowski fontconfig@fontconfig.org
Wed, 7 May 2003 11:08:45 +0200


I've been profiling some KDE applications recently (namely Kmail, Konqueror 
and Konsole) using valgrind.

I've noticed that significant amount of startup time is devoted to Fontconfig 
related activities.

F.e.  for Konsole (i've started it and quited immediately to measure just the 
startup times).

a call to FcInit consumes 33.49% of the total execution time.

FCinit calls 5 different functions but 4 of them are neglible only one stands 
out: FcLoadConfigAndFonts - it takes 33.49% (=it does most of the job in 

So i dig further:

Again, one call inside FcLoadConfigAndFonts consumes most of the time:

It's FcConfigBuildFonts and inside of it, FcDirScan takes 32.78% of total 

And we are close to the final now: in FcDirScan the function FcDirCacheReadDir 
takes 32.78% of total time (total time means total application execution 

And inside this function there is a lot of action but onfortunately i'm 
missing debugging symbols so i can not see all the function names but the 
first function calls mostly

FcNameParse who is responsible for 22.84% of total execution time..

If you are interested then i can send you my valgrind output files so you can 
all see it yourself.

But something is wrong with the fontconfig in the sense that it still takes 
too long just to load config at the startup despite the cache.

Can't we just dump the serialized binary config structures from the memory to 
disk and then only compare file dates and do the parsing only when necesary?

Or maybe a daemon holding configuration in the memory and serving it to 
interested applications?

What do you think about it guys? 1/3 of the startup time for KDE application 
is certainly worth the effort (and all GTK2 apps will also benefit).

congratulations for a great project by the way,
Krzysztof Dabrowski