memory mapped file

S

sunil

Hi,

I am trying to write large amount of data to 10 GB to csv file. If i
use memory-mapped file would it help in increasing the performance? I
am planning to dump 256 MB to file.

Regards,
sunhcl
 
A

Andreas Johansson

How are you planning to write to the file? Most IO is buffered so adding an
extra "buffer" by writing to a MemoryStream would most likely not increase
performance.
 
S

Stephen Martin

The relative performance of using a FileStream as opposed to memory-mapped
files basically comes down to usage patterns and hardware capabilities, not
so much the size of the file or the data you are accessing.

In the majority of cases file access is sequential or localized and a stream
based approach with the appropriate buffer size is definitely the better
method and should out perform memory-mapped files in virtually all cases. On
the other hand when your file access is random (if you find yourself using
Seek or Position frequently to move significant distances) then
memory-mapped files will usually out-perform stream based implementations,
sometimes by large margins.

Memory-mapped files are not directly supported by the .Net framework but are
relatively easy to implement using unmanaged code.

Though, from the sounds of your post you will be doing sequential type
access so the stream based approach is almost certainly superior for you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

fetch size 1
fetchsize question 5
imports succeed, but can't find data 0
PAE Per process 1
PAE flag 1
PAE flag issue 2
NVIDIA GeForce GTX 1080 8 GB 5
ERROR Watching Mapped drive 2

Top