There's little I can say about this as it's only a small section of your code. I can however point you to the fact that you're copying the array here:
Code: Select all
struct kOrderedArray temp = kPlace_OrderedArray((void*)start, HEAP_INDEX_SIZE, &kHeap_HeaderLessThan);
// I'm presuming heap->index isn't a pointer, so that means 'temp' will be entirely copied into 'heap->index'.
heap->index = temp;
Which is probably not the problem, but it might speed up things a little to just use a pointer to begin with or something.
You should also know that JamesM's 'OrderedArray' can actually simply be replaced by a simple (possibly doubly) linked list which lists heap headers from small to large and that 'Footer' is pretty much obsolete (except for easy of use, but you could just give every header a Previous member or something).
JamesM also said multiple times that he's probably least proud of his heap tutorial. He started a new series of tutorials (a while ago, now, I think) which can be found
here. You can find the heap in
Source -> Browse -> trunk -> src.
Hope this was of some help to you.
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.