[Mono-list] Array.CopyTo - Mono (Ubuntu) vs .Net (Windows)
const86
powerdeth at narod.ru
Thu Aug 1 18:16:32 UTC 2013
Is there a reason your video source requires this technique to buffer? This
code is inefficient because:
1. It allocates a new buffer every time it reads from the source buffer.
2. It removes data from the source buffer by doing 2 more heap and block
copies.
</qoute>
Yes buffer is needed.
I would like to use the "stack" buffer. That is, that would be required
bytes were always first.
In .NET it works very effectively. Almost the same as without it.
But, the main issue is, why must you dynamically allocate new buffers and
"remove" data from the source buffer in the first place? In the buffering
scenarios I'm familiar with, you would normally allocate a fixed-size buffer
which you would pass down to the underlying data provider along with the
start index and length to fill. Once your buffer is full, you stop reading
from the source until you drain your buffer. Your buffer is emptied not by
copying data and re-allocating a buffer, but by simply moving the index for
the start of your buffered data. Specifically, you might want to check out
this article on circular buffers.
</qoute>
Yes, I have come to the conclusion that it is necessary to use a circular
buffer.
Maybe this will solve the problem.
--
View this message in context: http://mono.1490590.n4.nabble.com/Array-CopyTo-Mono-Ubuntu-vs-Net-Windows-tp4660316p4660364.html
Sent from the Mono - General mailing list archive at Nabble.com.
More information about the Mono-list
mailing list