I have a question about using streams in .NET to load files from disk. I am trying to pinpoint a performance problem and want to be sure it's where I think it is.
Dim provider1 As New MD5CryptoServiceProvider Dim stream1 As FileStream
stream1 = New FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.Read) provider1.ComputeHash(stream1)
Q: Are the bytes read from disk when I create the FileStream object, or when the object consuming the stream, in this case an MD5 Hash algorithm, actually reads it?
I see significant performance problems on my web host when using the ComputeHash method, compared to my local test environment. I'm just trying to make sure that the performance problem is in the hashing and not in the disk access.