Greedy object hash #32
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've spent way too much time on this, but I have a fast, working implementation of greedy algorithm detecting patches using object_hash opts, as asked in #26
My benchmarks show it's between 2-5 times faster, thanks to reducing number of deep comparisions. If hash can't be computed, we fall back to pairwise comparision.
Created patches are optimal when there are only additions / removals, no matter where in list. I don't detect moves - tried to do it, but it's a can of worms. For now moves are mapped to pair of remove + add.
Implemented also an LCS-based solution, but it was slow and detecting conflicting moves was very complex. Decided to rewrite with a simpler solution.
Feel free to check tests. That branch is based on diff-performance-optimizations, should be more readable after merging performance fixes.
TODO:
benchmark: