Skip to main content

diff_piece_trees

Function diff_piece_trees 

Source
pub fn diff_piece_trees(
    before: &Arc<PieceTreeNode>,
    after: &Arc<PieceTreeNode>,
) -> PieceTreeDiff
Expand description

Compute a diff between two piece tree roots.

Uses structural sharing (Arc::ptr_eq) to skip identical subtrees in O(1), falling back to leaf-level comparison only for subtrees that actually differ. After path-copying edits, this is O(changed_path) instead of O(all_leaves).