By Đonny on
Recently I've discovered that when you have to work with large binary file byte-by-byte (ie. parse it using aan automaton), it is much more fater to load it using IO.File.ReadAllBytes() to byte array and then create IO.MemoryStream over such array than using stream retuned by IO.File.Open.
I've loop that used stream.ReadByte() again and again to iterate through file (cca 250MB) and it took several minutes using FileStream and several seconds using MemoryStream.
Writing slightly altered this file back to disk using FileStream (IO.File.Open) is quite fast as long as you preset file size using SetLength().