No need to rebalance heap for insertion
[lttng-modules.git] / lib / prio_heap / prio_heap.c
index c987d5de18cd10d690aa2c7152c95bc33b621dfa..29af3033812f98ba770ee28b855959b8dca82bfd 100644 (file)
@@ -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;
                }
This page took 0.023106 seconds and 4 git commands to generate.