On 1/31/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:
Nikolai Weibull wrote:
> On 1/30/07, Martin Krischik <[EMAIL PROTECTED]> wrote:
>> Am Dienstag 30 Januar 2007 schrieb [EMAIL PROTECTED]:
>>
>> > - being able to open very large files quickly and
>> > without using too much memory. This could possibly
>> > be achieved by not loading the entire file immediately.
>> > File could be loaded lazily when required.
>>
>> The last (and only) editor to have that feature was The Atari Editor
>> which run
>> on 8 bit Atari computers. Was a full screen, modeing editor like vim as
>> well :-).
>
> How do you mean?  A lot of editors work like this.  The Atari Editor
> is hardly the first, or last, editor to work this way.  Sam works this
> way, Wily works this way, my editor ned works this way, James Brown's
> example editor "Neatpad" [1] works this way.
>
> It's usually down to the data structure used to manage buffer contents
> that defines whether it's possible to implement this feature or not.
> It's can also be down to support for various encodings that can
> require preprocessing of the files.
>
> I'm not sure to what degree Vim requires the whole file to be read
> before editing can commence.  I'm, however, sure that it can be made
> to load files without too much preprocessing, but I'm also pretty sure
> that it would require a lot of work and I don't think it's worth the
> kind of time that Bram would have to invest in such a feature.  Vim
> is, when it all comes down to it, designed to be a programmers editor,
> and that means that it'll mostly work with files smaller, mostly much
> smaller, than a megabyte, for which preprocessing works fine.
>
>  nikolai
>
> [1] http://www.catch22.net/
>

IIUC, Vim loads the whole file in memory before starting to edit. It might be
possible (but not necessarily worth the trouble on modern computers with their
large memory and their huge virtual-memory addressing ranges) to only keep
parts of the file in memory; but:

[a list of reasons why preprocessing may be a hidden cost of commands
being run on the file at around load-time anyway.]

That is all true, but under certain conditions it may still be the
case that pre-loading the whole file is unnecessary.

Loading the whole file in memory at the start allows
building an index (or something) which will later allow lightning-fast access
to any line given by number.

Considering that lightning travels at the speed of light, I'd say that
this is an overestimation of the line-lookup routines.

Vim is not only a programmer's editor (in the sense of an editor which can be
used to edit source programs: even Notepad can do that).

My statement was more about the size of a typical file loaded into Vim
than its specific uses.  I consider(ed) that to be obvious.

 nikolai

Reply via email to