On 13/04/2012, Connor Lane Smith <c...@lubutu.com> wrote: > Your method, while simpler, requires 2n space to 'situ' a length n > file. A suitable patch format would require only enough space to store > the changes to the original file. The outcome would be identical, but > if we're trying to sed only a few changes in a large file it would be > more efficient in terms of storage.
True, if we trim the start and finish lazily, but worst-case diff algorithm space usage is worse — quadratic, if I'm not mistaken.