[Fontconfig] Realloc called too often in FcCharSetPutLeaf

Michal Novotny michal at allpeers.com
Thu Feb 14 08:38:17 PST 2008


Hi,

I was looking at performance of FireFox3 startup using callgrind and 
found a lot of calls to realloc() from FcCharSetPutLeaf(). During the 
startup there are 10 calls to FcFontSort() that lead to 105242 calls to 
FcCharSetPutLeaf() and 209842 calls to realloc(). I tried to 
allocate/reallocate memory in bigger blocks and calls to realloc() were 
reduced to 25982 when block size was 8 (patch is attached). Of course 
some memory is wasted with this approach but number of instructions 
needed to do FcFontSort() decreased from 176569552 to 125762052. Is it 
possible to have similar optimalization in next releases of fontconfig?

Michal


-------------- next part --------------
A non-text attachment was scrubbed...
Name: fccharset.c.patch
Type: text/x-patch
Size: 2669 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20080214/e9059cf6/attachment.bin 


More information about the Fontconfig mailing list