encounter / objdiff

A local diffing tool for decompilation projects
Apache License 2.0
99 stars 18 forks source link

Simplify Affix::find #24

Closed NickCondron closed 1 year ago

NickCondron commented 1 year ago

The previous version was needlessly complicated. Clever use of iterators makes the code much simpler.

I also removed the unused LevMatchingBlock struct.

I wanted to work on refactoring the levenshtein functions, but I didn't understand the semantics of the indexes first_start and second_start or if the code relies on a certain behavior when resolving ambiguous edits.

NickCondron commented 1 year ago

Thinking about it more, we should probably just use: https://github.com/ajmalsiddiqui/levenshtein-diff

encounter commented 1 year ago

Hmm, that one doesn’t look super great imo. For one, DistanceMatrix being Vec<Vec<>> is a poor choice for memory allocations and cache locality. I think cleaning up editops.rs is more ideal.

NickCondron commented 1 year ago

I'm going to reopen this because I think the changes are good for now. I still feel like Levenshtein distance should be the type of thing an external crate can do well, but I agree there's some drawbacks to the linked crate.