Class used internally by Diff to actually compute the diffs.

The algorithm used here is mostly lifted from the perl module Algorithm::Diff (version 1.06) by Ned Konz, which is available at:

More ideas are taken from:

Some ideas are (and a bit of code) are from from analyze.c, from GNU diffutils-2.7, which can be found at:

closingly, some ideas (subdivision by NCHUNKS > 2, and some optimizations) are my own.

Line length limits for robustness added by Tim Starling, 2005-08-31 Alternative implementation added by Guy Van den Broeck, 2008-07-30

@author Geoffrey T. Dairiki, Tim Starling, Guy Van den Broeck @private


Expanded class hierarchy of DiffEngine

Related topics


core/includes/, line 166
A PHP diff engine for phpwiki. (Taken from phpwiki-1.3.3)


Contains filters are case sensitive
Namesort ascending Modifiers Type Description
DiffEngine::shiftBoundaries private function Adjust inserts/deletes of identical lines to join changes as much as possible.
DiffEngine::MAX_XREF_LENGTH constant
DiffEngine::lineHash private function Returns the whole line if it's small enough, or the MD5 hash otherwise
DiffEngine::lcsPos private function
DiffEngine::diffLocal private function
DiffEngine::diff function
DiffEngine::diag private function Divide the Largest Common Subsequence (LCS) of the sequences [XOFF, XLIM) and [YOFF, YLIM) into NCHUNKS approximately equally sized segments.
DiffEngine::compareSeq private function Find LCS of two sequences.
DiffEngine::$xv protected property
DiffEngine::$xind protected property
DiffEngine::$xchanged protected property
DiffEngine::$seq protected property
DiffEngine::$lcs protected property