Local text editor and diff checker
Traditional online diff tools require you to upload your source code, server logs, or sensitive documents to their backend servers. This poses a severe security risk for proprietary code and confidential text.
This tool completely eliminates that risk by performing all file reading and diffing directly in the browser's memory. Once the page is loaded, your files never leave your device.
Under the hood, this tool uses a variation of Myers' Diff Algorithm, invented by Eugene W. Myers in 1986. This is the exact same algorithm that powers Git.
Its goal is to find the Longest Common Subsequence (LCS) between two files to determine the minimum number of insertions and deletions needed to transform file A into file B.
If we ran Myers' algorithm character-by-character on a 10,000-line log file, the browser would freeze. The time complexity of the algorithm is roughly O(ND) where N is the sum of the lengths of the sequences and D is the size of the minimum edit script.
To solve this, the tool performs Line Tokenization. It splits the file by newlines and treats each entire line as a single "token" (like a single character). It then runs the algorithm on those tokens. This reduces a 1,000,000-character comparison into a 10,000-line comparison, making it thousands of times faster and enabling real-time diffing in the browser.
Why does this tool use 'Line Tokenization' before running the diff algorithm?