The room class contains a multi-dimensional array of Block like this:
public Block[,] Blocks { get; private set; }
Because Block is a class, the memory access pattern is completely random:
Each array entry only stores a reference to a Block and the data itself is just somewhere randomly in memory.
With a struct, the elements are contiguous in the array itself. which allows a more efficient access pattern, especially for large group transformations of blocks such as rotation, smart geometry and copying rooms.
The room class contains a multi-dimensional array of
Block
like this:Because
Block
is a class, the memory access pattern is completely random: Each array entry only stores a reference to aBlock
and the data itself is just somewhere randomly in memory.With a
struct
, the elements are contiguous in the array itself. which allows a more efficient access pattern, especially for large group transformations of blocks such as rotation, smart geometry and copying rooms.