N
n!
why value types which are stored in the stack, give better performance,
It is quicker to move the stack pointer than it is to allocate memory.
Allocating referenced objects is still fast in managed code, but changing
the stack pointer is still faster. Also taking into account that a method
knows which value types are created internally and thus they all get
allocated at once on entry to the method (or as part of their owning
object).
n!
than reference types which are stored in the heap?
are not both stored in the ram?
It is quicker to move the stack pointer than it is to allocate memory.
Allocating referenced objects is still fast in managed code, but changing
the stack pointer is still faster. Also taking into account that a method
knows which value types are created internally and thus they all get
allocated at once on entry to the method (or as part of their owning
object).
n!