[Fontconfig] mmaping FcInit
Patrick Lam
plam at MIT.EDU
Tue Mar 22 17:05:54 EST 2005
Owen Taylor wrote:
> The fontconfig caches live in the font directories, which may be
> shared between machines with different architectures. For that reason,
> even if you remove pointers, you can't simply put a structure into
> the file... the endianess and structure packing may differ between
> machines.
I was thinking that it would be quicker to create a file on a per-user
basis, but I suppose that users might still log on using different archs.
In fact FcPatterns themselves don't take up much room (using an
FcPattern struct as you propose would probably double the amount of room
taken). However, the FcValues contained within the FcPatternElts do
take up a lot of room, I think. And if we put the FcConfig in an
mmap'ed file, we can't put any pointers to FcPatterns into the FcConfig,
only indices into an array.
> struct FcPattern {
> int refcount;
> FcPatternStorage storage; /* dynamic, static */
>
> union {
> FcPatternDynamic *dynamic;
> FcPatternStatic *static;
> } u;
> };
>
> You might also want to think about the ability to put hash-table indices
> into the mmap'ed file ... fontconfig programs can spend
> a lot of time scanning through a large list of patterns linearly
> to find a matching family name.
Seems like a good thing to work on after I have an initial version with
the mmapable config. I think someone's recently added some hashing, too.
pat
More information about the Fontconfig
mailing list