May 09, 2005 File / BufferedFile / MmFile | ||||
---|---|---|---|---|
| ||||
Simple question: When should I use what? -File for small files (Saved settings in .ini files) ? -BufferedFile for big files that get changed frequently (Logfiles) ? -MmFile for very big files (Database files) ? And another: What is the difference between buffered files and memory-mapped files? MmFiles can be flush()ed, BufferedFiles can't, I know. But is this really the only reason why MmFile is seperated from the other file classes? Thanks, Florian |
May 09, 2005 Re: File / BufferedFile / MmFile | ||||
---|---|---|---|---|
| ||||
Posted in reply to Florian Sonnenberger | "Florian Sonnenberger" <nairolf@online.de> wrote in message news:d5odq6$1b52$1@digitaldaemon.com... > Simple question: > When should I use what? > > -File for small files (Saved settings in .ini files) ? > -BufferedFile for big files that get changed frequently (Logfiles) ? > -MmFile for very big files (Database files) ? > > And another: > What is the difference between buffered files and memory-mapped files? > MmFiles can be flush()ed, BufferedFiles can't, I know. But is this really > the only reason why MmFile is seperated from the other file classes? > > Thanks, > Florian BufferedFiles can be flushed, too (it writes the buffer contents to the OS file). To me the biggest difference is that you can't change the length of a mem-mapped file but you can grow a BufferedFile. Another difference that probably shouldn't be there is that a MmFile must be mapped all at once - it doesn't support mapping a small window of the backing file. A BufferedFile only buffers a small (8K or so) window of the backing file. OSes that I know allow mem-mapped files to map a portion of the backing file but MmFile always seems to map the whole thing. |
Copyright © 1999-2021 by the D Language Foundation