code-efficiency

Is this the best code to use for reading from a networkstream (vb.net)?

I know it's subjective but this was the result I came up with based on the answer to me previous question and it seems a bit "slapped together", as I have changed it quite a bit: Private Function ReadFromBuffer(ByVal objReader As NetworkStream) As Byte() Dim intRead As Integer = 1024 Dim allBytes(-1) As Byte While intRead...

When is calculating or variable-reading faster?

hi, to be honest, I don't really know what the "small green men" in my cpu and compiler do, so I sometimes would like to know :). Currently I would like to know what's faster, so that I can design my code in a more efficient way. So for example I want to calclate something at different points in my sourcecode, when will it be faster to...