You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The heap.Fix function first calls down and then calls up. If we moved the element down, we don't actually need to call up, saving a comparison (call to Less) in that case. We can do this by having down return whether the element moved and Fix can then do
if !down(h, i, j.Len()) {
up(h, i)
}
This one comparison won't matter in most cases, but if we have only a couple of elements, Less is expensive, and we repeatedly call Fix on the root, it can be significant.
Let me know 1) if it's ok to make this change, and 2) if someone who already has an environment for contributing set up wants to make it (otherwise I will do it).
The text was updated successfully, but these errors were encountered:
The
heap.Fix
function first callsdown
and then callsup
. If we moved the element down, we don't actually need to callup
, saving a comparison (call toLess
) in that case. We can do this by havingdown
return whether the element moved andFix
can then doThis one comparison won't matter in most cases, but if we have only a couple of elements,
Less
is expensive, and we repeatedly callFix
on the root, it can be significant.Let me know 1) if it's ok to make this change, and 2) if someone who already has an environment for contributing set up wants to make it (otherwise I will do it).
The text was updated successfully, but these errors were encountered: