Throughout the long history of my optimization attempts, I referred over and over again to an idea that I had early on: Given two consecutive full-memory Snapshots, compare all the lines from the beginning toward the end, stopping when you find a difference. Compare all the lines from the end toward the beginning, stopping when you find a difference. Save the lines in between they are the lines changed by the event that triggered the second Snapshot.
I refer to that idea many times, but I never tried it! It seems clear even now that it would work perfectly , thought it might (or might not) be a bit inefficient. If it were inefficient, it would likely be possible to optimize it by limiting what needs to be compared, depending on what the edit action actually was.
A simple, easy, and probably quite useful idea, and in over seventy pages of blather, I never tried it! Why? Im not sure. It seemed that I was seduced by ideas that were more clever and possibly more efficient. Unfortunately, those clever ideas were also incomplete, wrong, and too difficult to implement.
On the other hand, the line-comparing optimization would probably have been a good small step in the right direction. I never took that step!