C# FileStream : Optimal buffer size for writing large files?

Pygmy picture Pygmy · Dec 7, 2009 · Viewed 64.9k times · Source

Suppose I'm writing a couple of files to disk, between 2MB and 5GB. What are sensible buffer values for the FileStream ?

Is it sensible to work with buffersizes of several megabytes, or should I stick to kilobyte-buffers ?

Answer

Rubens Farias picture Rubens Farias · Dec 7, 2009

Default buffer size is 4 KiB.

Also, take a look here: Sequential File Programming Patterns and Performance with .NET