I have a large array of small structs that I would like to serialize to file.
The struct:
public struct Voxel
{
public byte density;
public byte material;
}
While there are quite a few serialization libraries that can do general serialization very efficiently, I suspect we can do even better in terms of on disk size and serialization/deserialization speed, given we know and control this struct.
This struct is pretty final, so we can do without the fancy versioning of many serialization library supports.
From my search, it seems like Marshal
might be a decent way to do such a thing, but I don't want to worry about things like Endianness.
So I wonder, what might be some good ways to serialize such data. Assuming the array size can be anywhere from 100 to 1mil?
(Also assuming we are not afraid to store them in different formats such that RLE can reduce the on-disk size even more.)