I wrote my own version of unix's diff when SPSS resequenced their source and my local mods turned bad. Line by line source comparison was the only way to save them.
I've always considered it odd that rather than attaching a unique identifier to every line, modern SCM systems depend on diff, a process I considere an emergency procedure.
I wrote SRCCOM in a hurry to solve my problem. I made it general enough to become a standard offering in our computing center. I wrote a couple of pages of Fortran and some assembly subroutines to make the I/O fast.
My algorithm was to keep parallel queues of unmatched lines and search them combinatorially with each new read. I bounded the queues so that this computation remained under control should the comparison get completely lost.
I didn't look at diff. But I knew that the diff available on unix 5 was known to "jackpot". This was when it gave up and told you that you'd changed everything.
I brought the source with me to Tektronix where it was used to manage source on some project in MDP. I know, because they came looking for my source as part of their archiving process at the end of their development cycle.