Yes, important. Matrix type violates one of the principles of .NET programming, the structure should not exceed 16 bytes. Usually 4 fields int. Matrix has 16 floating point fields, a total of 64 bytes.
The 16-byte recommendation relates to methods that are passed to / from the method in the generated machine code. Even the x86 core, which is especially starving for processor registers, has enough registers to allow the structure to store in processor registers instead of a stack frame. However, if it does not fit, the structure is passed through the stack stack. And it is copied both when calling and when receiving. It is expensive. The same applies to the return value.
The workaround for this expense is to pass the value of the structure through ref or out. Like the Multiply method. Now you only need to pass a pointer to the structure, 4 bytes per 32-bit kernel. With the overhead of having to dereference a pointer every time the code uses a structure field. What is good, what is needed for a class object.
source share