Poor performance when using Texas Instruments code generation tools in Wine

Jan Tore Korneliussen jan.tore.korneliussen at tandberg.net
Thu Feb 24 07:22:11 CST 2005


We found a simple solution (workaround?) to make this application 
perform well under WINE. Typical running time of the linking process is 
down from 30min to 15sec (!).

A short explanation: The TI linker allocates and frees a lot of small 
buffers, typical size 24-32 bytes - but we have not seen allocation of 
buffers smaller than 24 bytes. Due to fragmentation of the heap in WINE, 
the number of free buffers smaller than 24 bytes gradually increases. 
Since the free buffers are organized in 4 lists based on their size, the 
small (<24 bytes) buffers will go in the first list (which in the 
current version holds buffers of size <= 32), and each new allocation 
will have to search past these small buffers. After a while this 
consumes all processor time, due to the large number of allocations done 
by the linker.

A sufficient fix for this particular application is to introduce a new 
free list for buffers smaller than 24 bytes. In this way the small 
buffers will simply be skipped for each allocation, keeping allocation 
time relatively constant.

Note that this is a custom fix for this application, but maybe 
introducing more free list for small buffers can help other applications 
which allocate a lot of small buffers. I guess one has to collect data 
from a lot of apps to make a good tradeoff here. Anyway it was a good 
thing for us that the heap is "tunable".

The diff is with respect to Wine-20050211.tar.gz
dlls/ntdll/heap.c

-- 
Jan Tore Korneliussen
R&D Engineer
TANDBERG
Phone +47 6783 8514
mail  jan.tore.korneliussen at tandberg.net

-------------- next part --------------
85c85
< #define HEAP_NB_FREE_LISTS   5   /* Number of free lists */
---
> #define HEAP_NB_FREE_LISTS   4   /* Number of free lists */
90c90
<     0x10, 0x20, 0x80, 0x200, ~0UL
---
>     0x20, 0x80, 0x200, ~0UL


More information about the wine-devel mailing list