I ran a small test using C# using struct and class ... executed a simple method on each (console app) with WriteLine and used System.Diagnostics.StopWatch to measure.
My expectation was struct would be faster, but the results show them to be almost identical in performance.
There has been a lot of emphasis on stack vs. heap with the provision that heap has more processing overhead ... I've been fairly vigilant with my code thinking the stack is where I want to be if design construct fits.
So is there something else happening in the Virtual Execution System (aka CLR) that's doing some optimization that trivializes the stack and heap?
I must admit, I've never actually thought about testing this before, maybe I just need a more complex test to really see the difference?
Thoughts?
Cheers, Rob.