<div dir="ltr">Possible optimization<br><br>Hi!<br><br>I'm using a CGI program that includes fontconfig. (<a href="http://www.websequencediagrams.com">http://www.websequencediagrams.com</a>). I noticed that when I ran my program from the command line, it was taking 0.025 s to run. However, when apache2 ran it, it took about 1.5 seconds every time. This is even after running 'fc-cache -f' as root.<br>
<br>The culprit was fontconfig. In the /etc/fonts/fonts.conf supplied with Ubuntu 7.04, we have:<br><br><cachedir>/var/cache/fontconfig</cachedir><br><cachedir>~/.fontconfig</cachedir><br><br>When run by the www-data user (as a cgi-script), there is no ~/.fontconfig, so it was regenerating the cache each time.<br>
<br>Executing "chmod a+w -R /var/cache/fontconfig" solved the problem. Now fontconfig is fast even when executed by a cgi program.<br><br>I'm trying to understand what is happening here. Why can fontconfig only use the /var/cache/fontconfig folder if it is writable? And why does it regenerate the cache every time, even after fc-cache is run?<br>
<br></div>