[Fontconfig] Reducing allocation in FcFontSetSort

Cedric BAIL cedric.bail at free.fr
Mon Jun 15 02:43:43 PDT 2009


Hi,

   I am investigating why FcFontSetSort is allocating and freeing data
around 100000 times. So I first removed the main malloc inside
FcFontSetSort, but that's really not the main source of allocation. In
fact all the allocation is done inside FcSortWalk and freeing is done
by FcCharSetDestroy, when I am calling FcFontSetSort with csp == NULL
and trim == FcTrue. And looking inside FcSortWalk, when trim ==
FcTrue, FcCharSet will be created.
   It's the first time I look at FontConfig source code, and my
understanding of its code is quite limited, so does someone know why
it is needed to create this FcCharSet, as it seems to me that we
allocate/populate just to destroy them. Isn't it possible to change in
file src/fcmatch.c at line 602, the test "if (trim || build_cs)" by
just "if (build_cs)" and remove all this allocation ?

Regards,
-- 
Cedric BAIL
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fontconfig-one-less-malloc.diff
Type: text/x-diff
Size: 1512 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20090615/e82deea7/attachment.diff 


More information about the Fontconfig mailing list