previousupnext

5 Performance

This section explores the performance benefits of using LeapHeap in place of the Windows NT native heap.

The Microsoft algorithm is a sophisticated list-based memory manager that dedicates a separate free list to every 8-byte sizeclass up to 1 KB. Associated with each free list (subject to operating system version) is a lookaside list. The lookaside list allows allocations to be, in a sense, partially freed so that they can be allocated again without locking other threads out of the heap. The length of native heap lookaside lists starts at four entries and is dynamically adjusted during the life of the process. Lookaside lists reduce contention between threads.

This guide does not quantify the performance gain to be expected by substituting LeapHeap for the native heap, as that depends on the application and the scenario under which the application is being run. It would be easy to advertise some outrageous performance ratio based on a test program which has one implementation on the verge of thrashing and the other actually thrashing; it would also be pointless.

The heap usage behaviour of real-world applications is too varied to be represented by a benchmark program. Different allocation algorithms suit different programs, and doubtless there are conditions under which the native heap is faster than the LeapHeap. The confidence test program supplied with the LeapHeap download is typical in some respects, and may be parameterised to compare native heap and LeapHeap behaviour under various memory demands and thread counts. A few measurements made with this program are presented in section 5.5 Case Study.

When evaluating performance, two important features of typical programs are:

The first property relates to the frequent occurrence of programs defining just a few heavily used data types (such as C++ classes). The second relates to common coding practices such as building a linked list all in one go and tearing it down when its purpose has been served.

For the purpose of discussion it is convenient to imagine a model application behaving thus:

The heap usage pattern of the model application is favourable to LeapHeap performance, but LeapHeap is not confined to applications of this sort.


5.1 Intrinsic Efficiency
5.2 Memory Efficiency
5.3 Locality
5.4 Contention
5.5 Case Study