anchor.diff:              Node (Empty, Empty, value, 1u)
           | Node (l, r, n, _) ->
               let comparison = comparer.Compare (value, n)
  -            if comparison = 0 then                              // x = n
  +            if comparison = 0 then
  +                // x = n
                   tree
  -            elif comparison < 0 then                            // x < n
  +            elif comparison < 0 then
  +                // x < n
                   let l' = AvlTree.Insert (comparer, l, value)
  -                AvlTree.mkt_bal_l (n, l', r)
  -            else                                                // x > n
  +
  +                // Only rebalance the tree if an element was actually inserted.
  +                if l' === l then l
  +                else AvlTree.mkt_bal_l (n, l', r)
  +            else
  +                // x > n
                   let r' = AvlTree.Insert (comparer, r, value)
  -                AvlTree.mkt_bal_r (n, l, r')
  +                
  +                // Only rebalance the tree if an element was actually inserted.
  +                if r' === r then r
  +                else AvlTree.mkt_bal_r (n, l, r')
   
       /// Counts the number of elements in the tree.
       static member Count (tree : AvlTree<'T>) =
  
positive.code:         | _ ->
              AvlTree<'T>.CompareStacks (comparer, [s1], [s2])
  
      /// Returns the height of a AvlTree.
      [<Pure>]
      static member private ComputeHeight (tree : AvlTree<'T>) =
          match tree with
  
negative.code:             n, l
          | Node (left, r, n, _) ->
              let na, l = AvlTree.DeleteMin left
              na, AvlTree.mkt_bal_r (n, l, r)
  
      /// Removes the maximum (greatest) value from an AvlTree,
      /// returning the value along with the updated tree.
  