From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,e55b9780504fa95e,start X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2001-10-18 03:10:47 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!diablo.theplanet.net!tank.news.pipex.net!pipex!server1.netnews.ja.net!hgmp.mrc.ac.uk!not-for-mail From: Tony Cox Newsgroups: comp.unix.tru64 Subject: mmap for fast file access? Date: 18 Oct 2001 11:10:38 +0100 Organization: BIOSCI/MRC Human Genome Mapping Project Resource Centre Sender: ac2@wallaby.sanger.ac.uk Message-ID: NNTP-Posting-Host: wallaby.sanger.ac.uk X-Trace: niobium.hgmp.mrc.ac.uk 1003399843 7887 193.62.207.143 (18 Oct 2001 10:10:43 GMT) X-Complaints-To: news@net.bio.net NNTP-Posting-Date: Thu, 18 Oct 2001 10:10:43 +0000 (UTC) X-Newsreader: Gnus v5.5/Emacs 20.3 Xref: archiver1.google.com comp.unix.tru64:5383 Hi, I have an application that involves parsing a large number of text files (say 1000 of say 60-100Mb each) and I want to do this as quickly as possible. At the moment I just read the files line by line into a buffer (using the C++ getline function). I'd like to speed this up by reading in the files using memory mapping instead, and the Compaq realtime programmers guide is pretty clear on how to do this using mmap, but: 1. How much speedup am I likely to get by using memory mapping? 2. When reading a file sequentially, is it faster to mmap it into memory page by page as needed, or mmap it all at once (presumably the latter, if you have enough memory)? 3. Would it be faster to use a shared memory approach instead, e.g. shmat? The machine I'm likely to run this on uses Tru64 UNIX 5.1. Thanks in advance, Tony Cox -- ------------------------------------------------------------- Dr. Anthony J. Cox -. .-. .-. .-. .-. .- Informatics Division, ||\ /|||X|||\ /|||X|||\ /|| The Sanger Centre, |||X|||/ \|||X|||/ \|||X||| Hinxton, Cambridge CB10 1SD, UK `-' `-' `-' `-' `-' `-' -. .-. .-. .-. .-. .- ||\ /|||X|||\ /|||X|||\ /|| ac2 at sanger dot ac dot uk |||X|||/ \|||X|||/ \|||X||| `-' `-' `-' `-' `-' `-' -------------------------------------------------------------