9

I often see 4096 used as a default buffer size all over the place. Is there any reason why 4096 was selected as opposed to another value?

myermian
  • 29,999
  • 21
  • 111
  • 199

1 Answers1

4

It is realy depending on your problem but a general compromise solution for the problem is 4KB. A good description for this choice you will find it under the below listed links:

File I/O with streams - best memory buffer size

http://social.msdn.microsoft.com/Forums/en-US/ed3c6dea-400e-489c-9a86-b43b3a78cc1c/quick-question-about-filestream-buffering?forum=csharpgeneral

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

Community
  • 1
  • 1
Bassam Alugili
  • 13,927
  • 7
  • 49
  • 67