[contrib] Edit distance match finder#2036
Merged
bimbashrestha merged 1 commit intofacebook:devfrom Mar 23, 2020
Merged
Conversation
Contributor
Author
|
Ping. Should we merge this or leave it out? Both seems reasonable to me. Might be useful if someone ever wants to experiment with edit distance based match finding in the future. |
Cyan4973
approved these changes
Mar 23, 2020
Contributor
|
I think it's fine to merge it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Turned out to not provide enough utility to make up for the additional CPU usage. Including this in contrib with some light docs in case this becomes interesting again.
The one place where this outperforms zstd-19 for compression ratio consistently is when compressing a small file (<10KB) with a small and similar in content dictionary (a use case which doesn't really exist as far as I can tell). There are very few overlapping matches in those cases so edit distance basically does as good of a job as can be done.
For large files, this is 5-10X slower than zstd-19 and 2-3X worse in terms of compression ratio. I Think most of the loss is in being unable to find overlapping matches.
References:
An O(ND) Difference Algorithm and Its Variations:
http://www.xmailserver.org/diff2.pdf
An Algorithm for Differential File Comparison:
https://www.cs.dartmouth.edu/~doug/diff.pdf
A File Comparison Program:
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.189.70&rep=rep1&type=pdf
More information and references on diff algorithms on this page:
https://wiki.c2.com/?DiffAlgorithm