[英]How to estimate the size of byte array/buffer to read from NetworkStream?
int bufferSize = 8192;
Byte[] buffer = new Byte[bufferSize];
I need to read from a NetworkStream which would have a continuous flow of incoming data at a high rate. 我需要从NetworkStream中读取,这将以高速率连续输入数据流。 I wanted to know
我想知道
bufferSize
value? bufferSize
值的基础? Please consider performance as the focus point for the estimation. 请将绩效视为估算的重点。
There is only one sure way to optimize performance: measure, measure, measure. 优化绩效只有一种可靠的方法:衡量,衡量和衡量。
I've seen 1024, 4096 or 8192 used as buffer sizes for downloading files from the internet, and I haven't noticed any significant difference using either one. 我已经看到1024,4096或8192用作从Internet上下载文件的缓冲区大小,我没有注意到使用任何一个有任何显着差异。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.