Diff Algorithms
flo.znkr.io
Diff Algorithms
1–10 of 64 posts
Re: Diff Algorithms
#2https://diff2html.xyz/ -- https://github.com/rtfpessoa/diff2html
Re: Diff Algorithms
#3Re: Diff Algorithms
#4Apart from source code versioning what are the other most important real world use cases of diff algorithms ?
- integrity checks from security perspective
- nlp, finding same tokens in text
Etc
Re: Diff Algorithms
#5Apart from source code versioning what are the other most important real world use cases of diff algorithms ?
Long story short, due to the conservative culture, most data structures and algorithms were implemented in house. The diff algorithm for packets/segments/payloads was written in house too and I was the one to write it.
My implementation was based on a straightforward dynamic programming solution to the longest common subsequence problem. If I recall correctly, it ran in O(mn) time and O(min(m, n)) space in the worst case, where m and n are the lengths of the two sequences. I knew there were more efficient algorithms, but this code was not performance critical. I chose to keep the implementation simple so anyone could understand it, learn it quickly, and fix bugs if they arose. It served us well for the next seven years until the product was replaced with a new one.
On a related note, I sometimes miss that older style of software development where we would dive deep into a problem domain, master it, and design solutions ourselves. I am not being naively nostalgic though. I am very well aware that modern development, with its reliance on well established libraries, usually delivers much greater productivity and reliability. Still, I think the slower and more deliberate approach of building things from the ground up had a certain charm.
Re: Diff Algorithms
#6* Single-dimensional. Diffs of text lines are just this.
* Multi-dimensional. Diffs of words or characters are usually going to be this since lines still matter, but there are multiple approaches (line-first? weighted tokens?).
* Tree-based. Unfortunately, these are woefully scarce and poorly documented.
For text diffs, it's nontrivial to get the "missing newline at end of file" logic working.
For tree diffs, consider that for HTML something like `
x
y
` should be unmergeable, whereas `xy` should be mergeable.(Aside: the blind promotion of `` and `` did great harm to the notion of semantic HTML. Most things people use italics for (book titles, thoughts, foreign words) are explicitly things that `` should not be used for.)
Re: Diff Algorithms
#7Apart from source code versioning what are the other most important real world use cases of diff algorithms ?
Re: Diff Algorithms
#8There are at least 3 fundamentally different kinds of diff: * Single-dimensional. Diffs of text lines are just this. * Multi-dimensional. Diffs of words or characters are usually going to be this since lines still matter, but there are multiple approaches (line-first? weighted tokens?). * Tree-based. Unfortunately, these are woefully scarce and poorly documented. For text diffs, it's nontrivial to get the "missing ne…
Re: Diff Algorithms
#9Apart from source code versioning what are the other most important real world use cases of diff algorithms ?
Also in the legal space, sorting through discovery can be incredibly tedious. There are lots of diff-based and diff-like solutions in this space; most are completely proprietary and undocumented.