FileStream & MapViewOfFile comparison

  • Thread starter Thread starter Lloyd Dupont
  • Start date Start date
L

Lloyd Dupont

I need to access big data in a readonly fashion.
I was thinking to open a FileStream and seek and read as needed.
I was wondering if it was worth doing my own FileStream class which would
use internally use MapViewOfFile internally?
Or pehaps a purely managed wrapper which, at least, load the bytes in 4k
memory buffer (and update the buffer everytime I move)?
 
Lloyd Dupont said:
I need to access big data in a readonly fashion.
I was thinking to open a FileStream and seek and read as needed.
I was wondering if it was worth doing my own FileStream class which would
use internally use MapViewOfFile internally?

Most likely, no. The file system already does read-ahead buffering and
generally will do a better job of managing the memory than you can do in
your application. Unless your needs are very unusual, it's best to just use
the OS-supplied file buffering - which FileStream will use since it's just a
simple wrapper over the Win32 file I/O operations.

-cd
 
thanks!
Carl Daniel said:
Most likely, no. The file system already does read-ahead buffering and
generally will do a better job of managing the memory than you can do in
your application. Unless your needs are very unusual, it's best to just
use the OS-supplied file buffering - which FileStream will use since it's
just a simple wrapper over the Win32 file I/O operations.

-cd
 
Back
Top