As others have already mentioned, the getters are inlined.
If you want to avoid inlining, you have to
-
replace the automatic properties with manual ones:
class A { private double p; public double P { get { return p; } set { p = value; } } }
-
and tell the compiler not to inline the getter (or both, if you feel like it):
[MethodImpl(MethodImplOptions.NoInlining)] get { return p; }
Note that the first change does not make a difference in performance, whereas the second change shows a clear method call overhead:
Manual properties:
auto getter. 519005. 10000971,0237547.
field. 514235. 20001942,0475098.
No inlining of the getter:
auto getter. 785997. 10000476,0385552.
field. 531552. 20000952,077111.