4 ms·
This is addressed in the article: > “But Rob,” I hear you say, “they’re not reading it byte-by-byte in the PHP version!” and I’d reply with, “but we’re not rea
by notRobot 5y ago
This is addressed in the article:
> “But Rob,” I hear you say, “they’re not reading it byte-by-byte in the PHP version!” and I’d reply with, “but we’re not reading it byte-by-byte in the C# version either!”
C# also reads in 4K chunks: https://github.com/dotnet/runtime/blob/1ba0394d71a4ea6bee7f6b28a22d666b7b56f913/src/libraries/System.Private.CoreLib/src/System/IO/StreamReader.cs#L649-L767 https://github.com/dotnet/runtime/blob/1ba0394d71a4ea6bee7f6...
- alkonaut 5y agoThat just means there aren’t 4K times as many file read ops. The read() calls (which most of the time just increment the index into the buffer and returns what’s there) are still made. The usual way of doing what he’s trying to do will look exactly the same in C# as in his php version, with explicit buffering.