[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mmap visited files?

From: Stefan Monnier
Subject: Re: mmap visited files?
Date: 18 Feb 2002 17:38:25 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50

>>>>> "phr-2002" == phr-2002  <address@hidden> writes:
> This is an idea for some unknown future Emacs.  I wonder if it's
> feasible, when someone first visits a file, to simply mmap it instead
> of reading it all into memory.  This would allow viewing and browsing
> large files to start up a little faster than the current approach.

As Eli pointed out, this won't work too well because the character
encoding is generally different in-core than in-file.  It would work
for binary data and could also work for utf-8 files when Emacs is
changed to use utf-8 internally.  But it will still fail on DOS because
of the idiot CRLF convention which still requires conversion between
the in-core representation and the representation used in the files.

On the other hand, it is true that mmapping could be used for the
auto-save files since those use the same in-file representation as
the one used in-core.
But that wouldn't speed up opening of large files :-(

> Of course if the buffer gets modified, it's messy to not read it all
> in at that point.  So buffer objects would just have a flag saying
> whether the contents were a 'real' buffer or just a mapped file.

I'd rather represent the buffer as a set of buffer-subsequences where
some can be mmapped from a file, so you can modify a buffer while
still using the mmapped data for the unmodified portions of the buffer.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]