difft::diff::lcs_diff

Function slice_unique_by_hash

Source
pub(crate) fn slice_unique_by_hash<'a, T: Eq + Clone + Hash>(
    lhs: &'a [T],
    rhs: &'a [T],
) -> Vec<DiffResult<&'a T>>
Expand description

Compute the linear diff between lhs and rhs. If there are items that only occur on a single side, mark them as novel without processing them with Myers’ diff.

This is substantially faster than slice, when lhs and rhs have few items in common.

(This heuristic is used in traditional diff tools too, such as GNU diff.)