| Store | Cart

Scanning a file

From: Fredrik Lundh <fred...@pythonware.com>
Sat, 29 Oct 2005 08:48:18 +0200
Mike Meyer wrote:

> Did you do timings on it vs. mmap? Having to copy the data multiple> times to deal with the overlap - thanks to strings being immutable -> would seem to be a lose, and makes me wonder how it could be faster> than mmap in general.

if you use "mmap" to read large files sequentially, without calling "madvise",
the system may try to keep old pages around just in case, and won't do as
much read-ahead as it can do.  if you're low on memory, that means that
the system may waste some time swapping out data for other applications,
rather than throwing away data that you know that you will never look at
again.

if you have reasonably large files and you're not running on an overcrowded
machine, this is usually not a problem.

(does Python's mmap module support madvise, btw?  doesn't look like it does...)

</F>

Recent Messages in this Thread
Fredrik Lundh Oct 30, 2005 07:55 am
Paul Watson Oct 31, 2005 01:53 am
Fredrik Lundh Oct 29, 2005 06:48 am
Messages in this thread