5.5 Case Study

The confidence test that ships with LeapHeap (see section 7.3 The Confidence Test) may be used to explore its performance margin versus the NT native heap. This is an incidental use of the test, the purpose of which is to exercise the LeapAlloc and LeapFree routines and detect heap corruption.

The confidence test program is a typical application in certain respects. It spends about 10% (uniprocessor) or 13% (multiprocessor) of its time inside the heap routines when using the NT native heap. The remainder of the time is largely spent generating random (actually pseudo-random, as elsewhere in this section) numbers, and patterning memory. The density of its allocations tapers in line with the reciprocal of the cube of allocation size, which is credible; the smoothness of the size distribution is not.

A program run entails three phases. First HeapTest builds a heap, then it frees 20% of the allocations therein, to reach a state something like that of a mature, fragmented heap. During the third, 'churn' phase it (repeatedly) determines randomly whether its next action should be allocate or free. If the former, the size to request is selected at random; if the latter, an allocation is picked at random from all those extant. The time that the churn phase takes is the important metric, as that is the phase most representative of a server application in continuous operation.

The confidence test may be parameterised to use more or less memory and to run more or fewer threads. The default memory parameter of 50 MB was chosen so that the test would run without page-faulting on most machines. The default thread parameter of eight was chosen so that every processor on a quad machine would be likely to be assigned at least one thread. The work to be performed is shared out between whatever number of threads runs, so that the test duration should not be affected, other things being equal. A thread does not free other threads' allocations, only its own.

5.5.1 Intrinsic Performance
5.5.2 Memory Performance
5.5.3 Locality Comparison
5.5.4 Performance Under Contention