-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMethodCallTasks.cs
More file actions
164 lines (142 loc) · 4.18 KB
/
Copy pathMethodCallTasks.cs
File metadata and controls
164 lines (142 loc) · 4.18 KB
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
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 649
namespace StructBenchmarking
{
public class MethodCallWithStructArgumentTask : ITask
{
private readonly int size;
private readonly S16 s16;
private readonly S32 s32;
private readonly S64 s64;
private readonly S128 s128;
private readonly S256 s256;
private readonly S512 s512;
public MethodCallWithStructArgumentTask(int size)
{
this.size = size;
}
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
public void Run()
{
switch (size)
{
case 16:
PS16(s16);
break;
case 32:
PS32(s32);
break;
case 64:
PS64(s64);
break;
case 128:
PS128(s128);
break;
case 256:
PS256(s256);
break;
case 512:
PS512(s512);
break;
default:
throw new ArgumentException();
}
}
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
void PS16(S16 o)
{
}
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
void PS32(S32 o)
{
}
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
void PS64(S64 o)
{
}
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
void PS128(S128 o)
{
}
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
void PS256(S256 o)
{
}
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
void PS512(S512 o)
{
}
}
public class MethodCallWithClassArgumentTask : ITask
{
private readonly int size;
private readonly C16 c16;
private readonly C32 c32;
private readonly C64 c64;
private readonly C128 c128;
private readonly C256 c256;
private readonly C512 c512;
public MethodCallWithClassArgumentTask(int size)
{
this.size = size;
c16 = new C16();
c32 = new C32();
c64 = new C64();
c128 = new C128();
c256 = new C256();
c512 = new C512();
}
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
public void Run()
{
switch (size)
{
case 16:
PC16(c16);
break;
case 32:
PC32(c32);
break;
case 64:
PC64(c64);
break;
case 128:
PC128(c128);
break;
case 256:
PC256(c256);
break;
case 512:
PC512(c512);
break;
default:
throw new ArgumentException();
}
}
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
void PC16(C16 o)
{
}
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
void PC32(C32 o)
{
}
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
void PC64(C64 o)
{
}
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
void PC128(C128 o)
{
}
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
void PC256(C256 o)
{
}
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
void PC512(C512 o)
{
}
}
}