From: Mathieu Desnoyers Date: Mon, 23 May 2011 21:49:12 +0000 (-0400) Subject: No need to rebalance heap for insertion X-Git-Tag: v2.0-pre1~109 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6074d5430effe9efb2a1c8486cabcfbcb8eafb63;p=lttng-modules.git No need to rebalance heap for insertion Signed-off-by: Mathieu Desnoyers --- diff --git a/lib/prio_heap/prio_heap.c b/lib/prio_heap/prio_heap.c index c987d5de..29af3033 100644 --- a/lib/prio_heap/prio_heap.c +++ b/lib/prio_heap/prio_heap.c @@ -158,8 +158,11 @@ int heap_insert(struct ptr_heap *heap, void *p) ptrs[pos] = ptrs[parent(pos)]; ptrs[parent(pos)] = tmp; pos = parent(pos); - /* rebalance */ - heapify(heap, pos); + /* + * No need to rebalance: if we are larger than + * our parent, we are necessarily larger than + * its other child. + */ } else { break; }