Diff, Match and Patch

Demo of Diff

Diff takes two texts and finds the differences. This implementation works on a character by character basis. The result of any diff may contain 'chaff', irrelevant small commonalities which complicate the output. A post-diff cleanup algorithm factors out these trivial commonalities.

Text Version 1:

Text Version 2:

Diff timeout:

If the mapping phase of the diff computation takes longer than this, then the computation is truncated and the best solution to date is returned. While guaranteed to be correct, it may not be optimal. A timeout of '0' allows for unlimited computation.

Post-diff cleanup:

Increase human readability by factoring out commonalities which are likely to be coincidental.
, edit cost:
Increase computational efficiency by factoring out short commonalities which are not worth the overhead. The larger the edit cost, the more agressive the cleanup.
Raw output.

Back to Diff, Match and Patch