Around 16 o'clock on Aug 12, Juliusz Chroboczek wrote:
> KP> eliminate per-file syscalls when the cache file is up-to-date. > > Could you explain what exactly you're trying to avoid and how you > achieve that? Fontconfig computes information about each font. Instead of requiring that the user manually ensure that the information is up-to-date, fontconfig verifies it each time it starts. The original (slow) design in Xft simply recomputed the information each time the library started; this was fine when the user had few fonts and the information was relatively inexpensive (family name, style, etc). This involved opening each directory in the configuration and opening each font file in the directory. The second incarantion had two separate mechanisms. It had a shared cache file in each directory and a separate per-user cache file in $HOME. If the shared cache file was newer than the directory, the contents of that cache file were used without further verification. Directories not containing a valid cache file were manually scanned for files, and those filenames were looked up in the per-user cache file. Each file in the per-user cache was marked with a timestamp; if that timestamp matched the file change time, the font information in the cache was used. Otherwise, the file would be opened, and the computed font information would get written back to the per-user cache file. So, this second mechanism required opening each directory and stat'ing each file in the directory. With a really large number of directories containing a large number of files, even this mechanism was too expensive. In addition, the two mechanisms now made different assumptions about the state of the system -- the per-directory cache assumed that any changes to font files within the directory would be signalled by a change to the directory itself while the per-user cache checked each file and ignored the directory timestamp. By applying the assumptions made by the per-directory cache to the per-user cache, the poor performance of the per-user cache could be fixed without significantly impacting the overall correctness of the mechanism. So, now the per-user cache keeps timestamps for the directories as well as directories. When the cache timestamp for the directory matches, the cached information for each file within that directory is added without further verification. Otherwise, the directory is scanned and each file checked against the cache. Again, the per-user cache is automatically updated when this information changes, so the rescanning affects only the first application to run after the filesystem has changed. Keith Packard XFree86 Core Team HP Cambridge Research Lab _______________________________________________ Fonts mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/fonts