public static void InterfaceInterfaceMethodLongHierarchy() { AnInterface aInterface = new LongHierarchyChildClass(); //generate all the not-used call site first CallInterfaceMethod(new LongHierarchyClass1()); CallInterfaceMethod(new LongHierarchyClass2()); CallInterfaceMethod(new LongHierarchyClass3()); CallInterfaceMethod(new LongHierarchyClass4()); CallInterfaceMethod(new LongHierarchyClass5()); CallInterfaceMethod(new LongHierarchyClass6()); CallInterfaceMethod(new LongHierarchyClass7()); CallInterfaceMethod(new LongHierarchyClass8()); CallInterfaceMethod(new LongHierarchyClass9()); CallInterfaceMethod(new LongHierarchyClass11()); CallInterfaceMethod(new LongHierarchyClass12()); foreach (var iteration in Benchmark.Iterations) { using (iteration.StartMeasurement()) for (int i = 0; i < Benchmark.InnerIterationCount; i++) { CallInterfaceMethod(aInterface); } } }
public static void InterfaceInterfaceMethodSwitchCallType() { AnInterface aInterface = new LongHierarchyChildClass(); AnInterface aInterface1 = new LongHierarchyClass1(); foreach (var iteration in Benchmark.Iterations) { using (iteration.StartMeasurement()) { CallInterfaceMethod(aInterface); CallInterfaceMethod(aInterface1); } } }