3 ms·
The VM can only do most of its magic for fields where it can prove that they won’t get shared. That often is doable for local variables, but not for objects pas
by Someone 6y ago
The VM can only do most of its magic for fields where it can prove that they won’t get shared. That often is doable for local variables, but not for objects passed to or escaping a function.
Value types help (potentially a lot) in that they can make such objects more efficient. They also make it easier for the VM to prove fields won’t be shared (Rule: if it’s a value type, the value won’t be shared, because it can’t)