This means only possible initial optimization for large structures. The view that can occur when replacing a class with a structure. Small structures work best when they are passed by value, then members of the structure can be transmitted through the CPU registers without fear that they will transfer changes back to the caller. For passing by reference, an additional indirect appeal to each member access is required, which negates one advantage of the structure.
Passing a large structure by value carries the cost of copying the value of the struct when the method enters and exits. Jitter always assumes that access to a member should be fast, even if the odd access to a member will make link navigation more optimal. Technically, the optimizer can figure out what the best choice will be, but such a flow analysis is quite difficult to do correctly, optimizers always omit the problem with stopping. And these language changes had to be made without changing the CLR and jitter.
So blind application of in (or ref) is not a good idea, you should trade the cost of an extra copy pointer. Actually, this is what you are considering when the profiler shows you that a particular method call is a bottleneck. Like the C # team, I think these changes were inspired by the fact that Roslyn is faster.
source share