A BinaryFormatter-serialized array of 128³ doubles, takes up 50 MB of space. Serializing an array of 128³ structs with two double fields takes up 150 MB an
Serializing means that metadata is added so that the data can be safely deserialized, that's what's causing the overhead. If you serialize the data yourself without any metadata, you end up with 16 MB of data:
foreach (double d in array) {
byte[] bin = BitConverter.GetBytes(d);
stream.Write(bin, 0, bin.Length);
}
This of course means that you have to deserialize the data yourself also:
using (BinaryReader reader = new BinaryReader(stream)) {
for (int i = 0; i < array.Length; i++) {
byte[] data = reader.ReadBytes(8);
array[i] = BitConverter.ToDouble(data, 0);
}
}