From: Rob Nichols <rob@robnet.com>
Subject: Re: mmap for fast file access?
Date: Thu, 18 Oct 2001 20:19:56 GMT [thread overview]
Message-ID: <87adyor98z.fsf@muon.robnet.com> (raw)
In-Reply-To: rzwvghd2r8h.fsf@wallaby.sanger.ac.uk
I've spent a little time before trying to make reads of large files as
fast as possible. I'm sorry that I don't recall exactly what the
hardware was, I think the os was 4.0D, and the c++ compiler was around
6.1. The short of it was that std::iostream's were fairly slow.
Using std::getline into a std::string was very slow for large lines
(big lines, like 100k). I didn't see much difference between kernel
read() and mmap(), but both were *much* faster than std::iostream.
I was a little disapointed that iostream was this slow. I expect a
10% penelty for using iostream, but it was worse than that. While
read()/mmap() was much faster, it still seemed a little slow to me.
Seems like something like 6meg/second, but I realize that this number
doesn't help at all without knowning what the hardware was. I was
also a little surprised that read() and mmap() had very similar
performance. I guess it shouldn't be too much of a surprise with a
very fast (and wide) memory bus. (I tried mmap() all at once, or in
pieces, using various madvise() calls, and all had the same
performance.)
Again, this has been about a year ago, so could be old hardware, old
os, and my failing memory. I to would be very interested to hear from
others who found a faster way to read large files.
Later,
Rob
next prev parent reply other threads:[~2001-10-18 20:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-18 10:10 mmap for fast file access? Tony Cox
2001-10-18 20:19 ` Rob Nichols [this message]
2001-10-19 0:59 ` Bill Todd
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox