mitsuhiko / similar

A high level diffing library for rust based on diffs
https://insta.rs/similar
Apache License 2.0
949 stars 31 forks source link

Generic deduplication optimization #21

Closed mitsuhiko closed 3 years ago

mitsuhiko commented 3 years ago

It would be nice if the library could provide an optional optimization where it converts in a first step from the source items to de-duplicated items and run the the algorithm on that and then converts back to the original indexes afterwards.

Pseudocode:

let mut dedup = Dedupe::new(&mut d, &old, old_range, &new, new_range);
diff_slice(&dedup, &dedup.old_side(), dedup.old_range(), &dedup.new_side(), dedup.new_range());