public void PerformanceTestStructVsClassMethod(UInt32 runCount) { long before; XYClass c = new XYClass(); XYStruct s = new XYStruct(); // // Run once to jit the code // c.TestMe(); s.TestMe(); for (UInt32 run = 0; run < runCount; run++) { Console.WriteLine("Run {0}", run); before = Stopwatch.GetTimestamp(); for (int i = 0; i < 10000000; i++) { c.TestMe(); } Console.WriteLine("Class: " + (Stopwatch.GetTimestamp() - before).StopwatchTicksAsDoubleMilliseconds()); PrintGC("Class"); before = Stopwatch.GetTimestamp(); for (int i = 0; i < 10000000; i++) { s.TestMe(); } Console.WriteLine("Struct: " + (Stopwatch.GetTimestamp() - before).StopwatchTicksAsDoubleMilliseconds()); PrintGC("Struct"); } }