Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any reason that default buffer sizes are 4096? [closed]

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?

like image 575
myermian Avatar asked Mar 07 '14 20:03

myermian


People also ask

Why is buffer size 1024?

1024 is the exact amount of bytes in a kilobyte. All that line means is that they are creating a buffer of 16 KB. That's really all there is to it. If you want to go down the route of why there are 1024 bytes in a kilobyte and why it's a good idea to use that in programming, this would be a good place to start.

What is the max buffer size in C++?

The upper limit for the maximum buffer size is 32768␠bytes (32␠KB).

What is the optimal buffer size?

A good buffer size for recording is 128 samples, but you can also get away with raising the buffer size up to 256 samples without being able to detect much latency in the signal. You can also decrease the buffer size below 128, but then some plugins and effects may not run in real time.

What is StreamWriter buffer size?

StreamWriter. BaseStream property is initialized using stream . [Note: The default buffer size can typically be around 4 KB.]


1 Answers

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?

like image 133
Bassam Alugili Avatar answered Sep 17 '22 04:09

Bassam Alugili