From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,e55b9780504fa95e X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2001-10-18 13:20:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!207.115.63.138!newscon04.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr30.news.prodigy.com.POSTED!not-for-mail Sender: rob@muon.robnet.com Newsgroups: comp.unix.tru64 Subject: Re: mmap for fast file access? References: From: Rob Nichols Organization: None Message-ID: <87adyor98z.fsf@muon.robnet.com> User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.6 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: 216.63.181.65 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr30.news.prodigy.com 1003436396 ST000 216.63.181.65 (Thu, 18 Oct 2001 16:19:56 EDT) NNTP-Posting-Date: Thu, 18 Oct 2001 16:19:56 EDT X-UserInfo1: [[OWCYCDVBTMBFD[YRKNOPDA[X_LPO@FKY\@LWQHBATBTSUBYFWEAE[YJLYPIWKHTFCMZKVMB^[Z^DOBRVVMOSPFHNSYXVDIE@X\BUC@GTSX@DL^GKFFHQCCE\G[JJBMYDYIJCZM@AY]GNGPJD]YNNW\GSX^GSCKHA[]@CCB\[@LATPD\L@J\\PF]VR[QPJN Date: Thu, 18 Oct 2001 20:19:56 GMT Xref: archiver1.google.com comp.unix.tru64:5415 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