2008/12/11 Matias Larre Borges:

> On Thu, Dec 11, 2008 at 7:10 AM, Lee Naish <l...@csse.unimelb.edu.au> wrote:
>>
>> [...]
>
> This works fine :-)
>
> But I've been thinking and there is one thing that bothers me.
> With the original implementation, if the system ran out of memory in
> the middle of the join and couldn't allocate a new line with enough
> space for the resulting concatenation. Then the operation would be
> aborted but we still would had the first half of the lines beeing
> joined in one line.
> Whereas with this approach, the resulting file could be almost anything.
> I know this could never happen in practice. But, well, we never know.
>
> PS: Maybe I'm completly wrong about this. I'm just beginning to dive
> in vim's code so I could be missing something, but I'm eager to learn


The same problem would happen if we press Ctrl-C while joining:
instead of having the first few lines joined (as today), I guess we'd
end up with several lines joined. But if joining is deemed fast enough,
we can maybe remove the check for Ctrl-C while joining lines?
O(n^2) to O(n*log(n)) is certainly a major speed up.

A linear approach which would join lines in O(n)  (if that's not too hard
to do?) would not have these drawbacks.

-- Dominique

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui