[Fontconfig] Fontconfig performance question.

Krzysztof Dabrowski brushlst at pol.pl
Thu May 8 22:00:25 EST 2003


Dnia środa 07 maj 2003 06:28 pm, Keith Packard napisał:
> Around 11 o'clock on May 7, Krzysztof Dabrowski wrote:
> > FcNameParse who is responsible for 22.84% of total execution time..
>
> I'm interested in getting a replacement file structure for the current
> fonts.cache-1 files; those are now text files and parsing that is just too
> slow.
>
> Because the files are versioned, we really can completely redesign the
> format.

I'm thinking about something more radical:

I thought about serialising this struct to disk:

struct _FcConfig {
    FcStrSet    *configDirs;        /* directories to scan for fonts */
    FcChar8     *cache;             /* name of per-user cache file */
    FcBlanks    *blanks;
    FcStrSet    *fontDirs;
    FcStrSet    *configFiles;       /* config files loaded */
    FcSubst     *substPattern;      /* substitutions for patterns */
    FcSubst     *substFont;         /* substitutions for fonts */
    int         maxObjects;         /* maximum number of tests in all substs    
    FcFontSet   *fonts[FcSetApplication + 1];
    time_t      rescanTime;         /* last time information was scanned */
    int         rescanInterval;     /* interval between scans */
};

I'm more into Java programming these days and my C is a little rusty, so the 
question is: are there any automatic way to serialise a struct in C (or maybe 
a helper library exists)? If not then it should still be possible to dump it 
wholesale somehow.

And since font configuration rarely changes, then it could be loaded only one, 
then saved to disk for other applications to use and have a reasonable TTL (a 
day/week/whatever).

What do you think about it? If you could suggest me a right way of serialising 
it to disk then i could even try to program it in my spare time if i can 
manage to find any.

Kris






More information about the Fontconfig mailing list