Im developing an application using Visual Studio 2008 and C#.NET
Im reading images from a camera and I need to save them to hard disk as quickly as possible.
The image array is defined thus. It contains 1.5M shorts
short image = new short;
Im currently using the code below to save each image. However its not fast enough. A bottleneck occurs after a few dozen images.
Ive found some articles on the Internet that say the BinaryFormatter class is inefficient.
Has anyone had a similar problem or have an idea how I can speed things up. Im not really interested in getting the file size small (although if thats a side effect all the better) I just want the array to be saved to disk as quickly as possible.
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
int count = 0;
string fName = Directory.GetCurrentDirectory();
fName = fName + @"/" + Convert.ToString(count) + @".txt";
Stream myStream = new FileStream(fName, FileMode.Create);