-
Notifications
You must be signed in to change notification settings - Fork 272
/
LowLevelPerf.cs
830 lines (692 loc) · 25 KB
/
LowLevelPerf.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using BenchmarkDotNet.Attributes;
using MicroBenchmarks;
namespace PerfLabTests
{
[BenchmarkCategory(Categories.Runtime, Categories.Perflab)]
public class LowLevelPerf
{
public static int InnerIterationCount = 100000; // do not change the value and keep it public static NOT-readonly, ported "as is" from CoreCLR repo
// following fields are static public on purpose! to make sure JIT does not optimize the benchmarks to constants, do NOT change it
public static Class aClassFiled;
public static LongHierarchyChildClass aLongHierarchyChildClassField;
public static SealedClass aSealedClassField;
public static List<int> iListField;
public static StructWithInterface aStructWithInterfaceField;
public static AnInterface aInterfaceField;
public static AnInterface aInterfaceField1;
public static string stringField;
public static MyDelegate aInstanceDelegateField;
public static MyDelegate aStaticDelegateField;
public static GenericClass<int> aGenericClassWithIntField;
public static GenericClass<string> aGenericClassWithStringField;
public static object aObjectStringField;
public static object aObjectArrayOfStringField;
[Benchmark]
public void EmptyStaticFunction()
{
for (int i = 0; i < InnerIterationCount; i++)
{
Class.EmptyStaticFunction();
Class.EmptyStaticFunction();
Class.EmptyStaticFunction();
Class.EmptyStaticFunction();
Class.EmptyStaticFunction();
Class.EmptyStaticFunction();
Class.EmptyStaticFunction();
Class.EmptyStaticFunction();
Class.EmptyStaticFunction();
Class.EmptyStaticFunction();
}
}
[Benchmark]
public void EmptyStaticFunction5Arg()
{
for (int i = 0; i < InnerIterationCount; i++)
{
Class.EmptyStaticFunction5Arg(1, 2, 3, 4, 5);
Class.EmptyStaticFunction5Arg(1, 2, 3, 4, 5);
Class.EmptyStaticFunction5Arg(1, 2, 3, 4, 5);
Class.EmptyStaticFunction5Arg(1, 2, 3, 4, 5);
Class.EmptyStaticFunction5Arg(1, 2, 3, 4, 5);
Class.EmptyStaticFunction5Arg(1, 2, 3, 4, 5);
Class.EmptyStaticFunction5Arg(1, 2, 3, 4, 5);
Class.EmptyStaticFunction5Arg(1, 2, 3, 4, 5);
Class.EmptyStaticFunction5Arg(1, 2, 3, 4, 5);
Class.EmptyStaticFunction5Arg(1, 2, 3, 4, 5);
}
}
[GlobalSetup(Target = nameof(EmptyInstanceFunction))]
public void SetupEmptyInstanceFunction() => aClassFiled = new Class();
[Benchmark]
public void EmptyInstanceFunction()
{
Class aClass = aClassFiled;
for (int i = 0; i < InnerIterationCount; i++)
{
aClass.EmptyInstanceFunction();
aClass.EmptyInstanceFunction();
aClass.EmptyInstanceFunction();
aClass.EmptyInstanceFunction();
aClass.EmptyInstanceFunction();
aClass.EmptyInstanceFunction();
aClass.EmptyInstanceFunction();
aClass.EmptyInstanceFunction();
aClass.EmptyInstanceFunction();
aClass.EmptyInstanceFunction();
}
}
[GlobalSetup(Target = nameof(InterfaceInterfaceMethod))]
public void SetupInterfaceInterfaceMethod() => aClassFiled = new Class();
[Benchmark]
public void InterfaceInterfaceMethod()
{
AnInterface aInterface = aClassFiled;
for (int i = 0; i < InnerIterationCount; i++)
{
CallInterfaceMethod(aInterface);
CallInterfaceMethod(aInterface);
CallInterfaceMethod(aInterface);
CallInterfaceMethod(aInterface);
CallInterfaceMethod(aInterface);
CallInterfaceMethod(aInterface);
CallInterfaceMethod(aInterface);
CallInterfaceMethod(aInterface);
CallInterfaceMethod(aInterface);
CallInterfaceMethod(aInterface);
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
private void CallInterfaceMethod(AnInterface aInterface)
{
aInterface.InterfaceMethod();
}
[GlobalSetup(Target = nameof(InterfaceInterfaceMethodLongHierarchy))]
public void SetupInterfaceInterfaceMethodLongHierarchy()
{
aLongHierarchyChildClassField = 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());
}
[Benchmark]
public void InterfaceInterfaceMethodLongHierarchy()
{
var aInterface = aLongHierarchyChildClassField;
for (int i = 0; i < InnerIterationCount; i++)
CallInterfaceMethod(aInterface);
}
[GlobalSetup(Target = nameof(InterfaceInterfaceMethodSwitchCallType))]
public void SetupInterfaceInterfaceMethodSwitchCallType()
{
aInterfaceField = new LongHierarchyChildClass();
aInterfaceField1 = new LongHierarchyClass1();
}
[Benchmark]
public void InterfaceInterfaceMethodSwitchCallType()
{
AnInterface aInterface = aInterfaceField;
AnInterface aInterface1 = aInterfaceField1;
for (int i = 0; i < InnerIterationCount; i++)
{
CallInterfaceMethod(aInterface);
CallInterfaceMethod(aInterface1);
}
}
[GlobalSetup(Target = nameof(ClassVirtualMethod))]
public void SetupClassVirtualMethod() => aClassFiled = new Class();
[Benchmark]
public int ClassVirtualMethod()
{
SuperClass aClass = aClassFiled;
int x = 0;
for (int i = 0; i < InnerIterationCount; i++)
x = aClass.VirtualMethod();
return x;
}
[GlobalSetup(Target = nameof(SealedClassInterfaceMethod))]
public void SetupSealedClassInterfaceMethod() => aSealedClassField = new SealedClass();
[Benchmark]
public int SealedClassInterfaceMethod()
{
SealedClass aSealedClass = aSealedClassField;
int x = 0;
for (int i = 0; i < InnerIterationCount; i++)
x = aSealedClass.InterfaceMethod();
return x;
}
[GlobalSetup(Target = nameof(StructWithInterfaceInterfaceMethod))]
public void SetupStructWithInterfaceInterfaceMethod() => aStructWithInterfaceField = new StructWithInterface();
[Benchmark]
public int StructWithInterfaceInterfaceMethod()
{
StructWithInterface aStructWithInterface = aStructWithInterfaceField;
int x = 0;
for (int i = 0; i < InnerIterationCount; i++)
x = aStructWithInterface.InterfaceMethod();
return x;
}
[GlobalSetup(Target = nameof(StaticIntPlus))]
public void SetupStaticIntPlus() => aClassFiled = new Class(); // it's goint to call static ctor
[Benchmark]
public void StaticIntPlus()
{
for (int i = 0; i < InnerIterationCount; i++)
Class.aStaticInt += 1; // TODO: reconsider the design, the cost of inner loop iteration is as big as the benchmarked thing
}
[GlobalSetup(Target = nameof(ObjectStringIsString))]
public void SetupObjectStringIsString() => aObjectStringField = "aString1";
[Benchmark]
public bool ObjectStringIsString()
{
bool b = false;
for (int i = 0; i < InnerIterationCount; i++)
b = aObjectStringField is String;
return b;
}
[GlobalSetup(Target = nameof(NewDelegateClassEmptyInstanceFn))]
public void SetupNewDelegateClassEmptyInstanceFn() => aClassFiled = new Class();
[Benchmark]
public void NewDelegateClassEmptyInstanceFn()
{
Class aClass = aClassFiled;
MyDelegate aMyDelegate;
for (int i = 0; i < InnerIterationCount; i++)
aMyDelegate = new MyDelegate(aClass.EmptyInstanceFunction);
}
[Benchmark]
public void NewDelegateClassEmptyStaticFn()
{
MyDelegate aMyDelegate;
for (int i = 0; i < InnerIterationCount; i++)
aMyDelegate = new MyDelegate(Class.EmptyStaticFunction);
}
[GlobalSetup(Target = nameof(InstanceDelegate))]
public void SetupInstanceDelegate()
{
Class aClass = new Class();
aInstanceDelegateField = new MyDelegate(aClass.EmptyInstanceFunction);
}
[Benchmark]
public void InstanceDelegate()
{
MyDelegate aInstanceDelegate = aInstanceDelegateField;
for (int i = 0; i < InnerIterationCount; i++)
aInstanceDelegate();
}
[GlobalSetup(Target = nameof(StaticDelegate))]
public void SetupStaticDelegate() => aStaticDelegateField = new MyDelegate(Class.EmptyStaticFunction);
[Benchmark]
public void StaticDelegate()
{
MyDelegate aStaticDelegate = aStaticDelegateField;
for (int i = 0; i < InnerIterationCount; i++)
aStaticDelegate();
}
[GlobalSetup(Target = nameof(MeasureEvents))]
public void SetupMeasureEvents()
{
Class aClass = new Class();
aClass.AnEvent += new MyDelegate(aClass.EmptyInstanceFunction);
aClassFiled = aClass;
}
[Benchmark]
public void MeasureEvents()
{
Class aClass = aClassFiled;
for (int i = 0; i < InnerIterationCount; i++)
aClass.MeasureFire100();
}
[GlobalSetup(Target = nameof(GenericClassWithIntGenericInstanceField))]
public void SetupGenericClassWithIntGenericInstanceField() => aGenericClassWithIntField = new GenericClass<int>();
[Benchmark]
public void GenericClassWithIntGenericInstanceField()
{
for (int i = 0; i < InnerIterationCount; i++)
aGenericClassWithIntField.aGenericInstanceFieldT = 1;
}
[Benchmark]
public void GenericClassGenericStaticField()
{
for (int i = 0; i < InnerIterationCount; i++)
GenericClass<int>.aGenericStaticFieldT = 1;
}
[GlobalSetup(Target = nameof(GenericClassGenericInstanceMethod))]
public void SetupGenericClassGenericInstanceMethod() => aGenericClassWithIntField = new GenericClass<int>();
[Benchmark]
public int GenericClassGenericInstanceMethod()
{
GenericClass<int> aGenericClassWithInt = aGenericClassWithIntField;
int x = 0;
for (int i = 0; i < InnerIterationCount; i++)
x = aGenericClassWithInt.ClassGenericInstanceMethod();
return x;
}
[Benchmark]
public int GenericClassGenericStaticMethod()
{
int x = 0;
for (int i = 0; i < InnerIterationCount; i++)
x = GenericClass<int>.ClassGenericStaticMethod();
return x;
}
[Benchmark]
public int GenericGenericMethod()
{
int x = 0;
for (int i = 0; i < InnerIterationCount; i++)
x = Class.GenericMethod<int>();
return x;
}
[GlobalSetup(Target = nameof(GenericClassWithSTringGenericInstanceMethod))]
public void SetupGenericClassWithSTringGenericInstanceMethod()
{
aGenericClassWithStringField = new GenericClass<string>();
stringField = "foo";
}
[Benchmark]
public void GenericClassWithSTringGenericInstanceMethod()
{
GenericClass<string> aGenericClassWithString = aGenericClassWithStringField;
string aString = stringField;
for (int i = 0; i < InnerIterationCount; i++)
aGenericClassWithString.aGenericInstanceFieldT = aString;
}
[GlobalSetup(Target = nameof(ForeachOverList100Elements))]
public void SetupForeachOverList100Elements() => iListField = Enumerable.Range(0, 100).ToList();
[Benchmark]
public int ForeachOverList100Elements()
{
List<int> iList = iListField;
int iResult = 0;
for (int i = 0; i < InnerIterationCount; i++)
foreach (int j in iList)
iResult = j;
return iResult;
}
[GlobalSetup(Target = nameof(TypeReflectionObjectGetType))]
public void SetupTypeReflectionObjectGetType() => stringField = "aString";
[Benchmark]
public Type TypeReflectionObjectGetType()
{
Type type = null;
for (int i = 0; i < InnerIterationCount; i++)
type = stringField.GetType();
return type;
}
[GlobalSetup(Target = nameof(TypeReflectionArrayGetType))]
public void Setup() => aObjectArrayOfStringField = new string[0];
[Benchmark]
public Type TypeReflectionArrayGetType()
{
Type type = null;
for (int i = 0; i < InnerIterationCount; i++)
type = aObjectArrayOfStringField.GetType();
return type;
}
[Benchmark]
public string IntegerFormatting()
{
int number = Int32.MaxValue;
string result = null;
for (int i = 0; i < InnerIterationCount; i++)
result = number.ToString();
return result;
}
}
#region Support Classes
// classes and method needed to perform the experiments.
public interface AnInterface
{
int InterfaceMethod();
}
public class SuperClass : AnInterface
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
public virtual int InterfaceMethod() { return 2; }
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
public virtual int VirtualMethod()
{
return 1;
}
}
public struct ValueType
{
public int x;
public int y;
public int z;
}
public delegate int MyDelegate();
public struct StructWithInterface : AnInterface
{
public int x;
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
public int InterfaceMethod()
{
return x++;
}
}
public sealed class SealedClass : SuperClass
{
public int aInstanceInt;
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
public override int VirtualMethod()
{
return aInstanceInt++;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
public override int InterfaceMethod()
{
return aInstanceInt++;
}
}
/// <summary>
/// A example class. It inherits, overrides, has intefaces etc.
/// It excercises most of the common runtime features
/// </summary>
public class Class : SuperClass
{
public event MyDelegate AnEvent;
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
public override int VirtualMethod() { return aInstanceInt++; }
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
public override int InterfaceMethod() { return aInstanceInt++; }
public int aInstanceInt;
public string aInstanceString;
public static int aStaticInt;
public static string aStaticString = "Hello";
public static ValueType aStaticValueType;
[MethodImpl(MethodImplOptions.NoInlining)]
public static int EmptyStaticFunction()
{
return aStaticInt++;
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static int EmptyStaticFunction5Arg(int arg1, int arg2, int arg3, int arg4, int arg5)
{
return aStaticInt++;
}
[MethodImpl(MethodImplOptions.NoInlining)]
public int EmptyInstanceFunction()
{
return aInstanceInt++;
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static int GenericMethod<T>()
{
return aStaticInt++;
}
public void MeasureFire100()
{
#region callAnEvent
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
AnEvent();
//});
#endregion
}
}
public class GenericClass<T>
{
[MethodImpl(MethodImplOptions.NoInlining)]
public T ClassGenericInstanceMethod()
{
tmp++; // need this to not be optimized away
return aGenericInstanceFieldT;
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static T ClassGenericStaticMethod()
{
sTmp++; // need this to not be optimized away
return aGenericStaticFieldT;
}
public static int sTmp;
public int tmp;
public T aGenericInstanceFieldT;
public static T aGenericStaticFieldT;
}
#region LongHierarchyClass
public class LongHierarchyClass1 : AnInterface
{
[MethodImpl(MethodImplOptions.NoInlining)]
public virtual int InterfaceMethod() { return 2; }
[MethodImpl(MethodImplOptions.NoInlining)]
public virtual int VirtualMethod()
{
return 1;
}
}
public class LongHierarchyClass2 : LongHierarchyClass1
{
[MethodImpl(MethodImplOptions.NoInlining)]
public override int InterfaceMethod() { return 2; }
[MethodImpl(MethodImplOptions.NoInlining)]
public override int VirtualMethod()
{
return 1;
}
}
public class LongHierarchyClass3 : LongHierarchyClass2
{
[MethodImpl(MethodImplOptions.NoInlining)]
public override int InterfaceMethod() { return 2; }
[MethodImpl(MethodImplOptions.NoInlining)]
public override int VirtualMethod()
{
return 1;
}
}
public class LongHierarchyClass4 : LongHierarchyClass3
{
[MethodImpl(MethodImplOptions.NoInlining)]
public override int InterfaceMethod() { return 2; }
[MethodImpl(MethodImplOptions.NoInlining)]
public override int VirtualMethod()
{
return 1;
}
}
public class LongHierarchyClass5 : LongHierarchyClass4
{
[MethodImpl(MethodImplOptions.NoInlining)]
public override int InterfaceMethod() { return 2; }
[MethodImpl(MethodImplOptions.NoInlining)]
public override int VirtualMethod()
{
return 1;
}
}
public class LongHierarchyClass6 : LongHierarchyClass5
{
[MethodImpl(MethodImplOptions.NoInlining)]
public override int InterfaceMethod() { return 2; }
[MethodImpl(MethodImplOptions.NoInlining)]
public override int VirtualMethod()
{
return 1;
}
}
public class LongHierarchyClass7 : LongHierarchyClass6
{
[MethodImpl(MethodImplOptions.NoInlining)]
public override int InterfaceMethod() { return 2; }
[MethodImpl(MethodImplOptions.NoInlining)]
public override int VirtualMethod()
{
return 1;
}
}
public class LongHierarchyClass8 : LongHierarchyClass7
{
[MethodImpl(MethodImplOptions.NoInlining)]
public override int InterfaceMethod() { return 2; }
[MethodImpl(MethodImplOptions.NoInlining)]
public override int VirtualMethod()
{
return 1;
}
}
public class LongHierarchyClass9 : LongHierarchyClass8
{
[MethodImpl(MethodImplOptions.NoInlining)]
public override int InterfaceMethod() { return 2; }
[MethodImpl(MethodImplOptions.NoInlining)]
public override int VirtualMethod()
{
return 1;
}
}
public class LongHierarchyClass10 : LongHierarchyClass9
{
[MethodImpl(MethodImplOptions.NoInlining)]
public override int InterfaceMethod() { return 2; }
[MethodImpl(MethodImplOptions.NoInlining)]
public override int VirtualMethod()
{
return 1;
}
}
public class LongHierarchyClass11 : LongHierarchyClass10
{
[MethodImpl(MethodImplOptions.NoInlining)]
public override int InterfaceMethod() { return 2; }
[MethodImpl(MethodImplOptions.NoInlining)]
public override int VirtualMethod()
{
return 1;
}
}
public class LongHierarchyClass12 : LongHierarchyClass11
{
[MethodImpl(MethodImplOptions.NoInlining)]
public override int InterfaceMethod() { return 2; }
[MethodImpl(MethodImplOptions.NoInlining)]
public override int VirtualMethod()
{
return 1;
}
}
public class LongHierarchyChildClass : LongHierarchyClass12
{
[MethodImpl(MethodImplOptions.NoInlining)]
public override int InterfaceMethod() { return 2; }
[MethodImpl(MethodImplOptions.NoInlining)]
public override int VirtualMethod()
{
return 1;
}
}
#endregion
#endregion
}