-
Notifications
You must be signed in to change notification settings - Fork 0
/
SwitchBenchmark.cs
150 lines (129 loc) · 2.97 KB
/
SwitchBenchmark.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
using BenchmarkDotNet.Attributes;
namespace StaticTypeDictionaryBenchmark
{
[ShortRunJob]
public class SwitchBenchmark
{
private static readonly Request1 Request1 = new();
private static readonly Request100 Request100 = new();
private static readonly Request200 Request200 = new();
private static readonly Request300 Request300 = new();
private static readonly Request400 Request400 = new();
private static readonly Request500 Request500 = new();
private static readonly Request600 Request600 = new();
private static readonly Request700 Request700 = new();
private static readonly Request800 Request800 = new();
private static readonly Request900 Request900 = new();
private static readonly Request1000 Request1000 = new();
[Benchmark]
public int SwitchRequest1()
{
return SwitchHelper.Switch(Request1);
}
[Benchmark]
public int SwitchRequest100()
{
return SwitchHelper.Switch(Request100);
}
[Benchmark]
public int SwitchRequest200()
{
return SwitchHelper.Switch(Request200);
}
[Benchmark]
public int SwitchRequest300()
{
return SwitchHelper.Switch(Request300);
}
[Benchmark]
public int SwitchRequest400()
{
return SwitchHelper.Switch(Request400);
}
[Benchmark]
public int SwitchRequest500()
{
return SwitchHelper.Switch(Request500);
}
[Benchmark]
public int SwitchRequest600()
{
return SwitchHelper.Switch(Request600);
}
[Benchmark]
public int SwitchRequest700()
{
return SwitchHelper.Switch(Request700);
}
[Benchmark]
public int SwitchRequest800()
{
return SwitchHelper.Switch(Request800);
}
[Benchmark]
public int SwitchRequest900()
{
return SwitchHelper.Switch(Request900);
}
[Benchmark]
public int SwitchRequest1000()
{
return SwitchHelper.Switch(Request1000);
}
[Benchmark]
public int StaticSwitchRequest1()
{
return StaticSwitchHelper.Switch(Request1);
}
[Benchmark]
public int StaticSwitchRequest100()
{
return StaticSwitchHelper.Switch(Request100);
}
[Benchmark]
public int StaticSwitchRequest200()
{
return StaticSwitchHelper.Switch(Request200);
}
[Benchmark]
public int StaticSwitchRequest300()
{
return StaticSwitchHelper.Switch(Request300);
}
[Benchmark]
public int StaticSwitchRequest400()
{
return StaticSwitchHelper.Switch(Request400);
}
[Benchmark]
public int StaticSwitchRequest500()
{
return StaticSwitchHelper.Switch(Request500);
}
[Benchmark]
public int StaticSwitchRequest600()
{
return StaticSwitchHelper.Switch(Request600);
}
[Benchmark]
public int StaticSwitchRequest700()
{
return StaticSwitchHelper.Switch(Request700);
}
[Benchmark]
public int StaticSwitchRequest800()
{
return StaticSwitchHelper.Switch(Request800);
}
[Benchmark]
public int StaticSwitchRequest900()
{
return StaticSwitchHelper.Switch(Request900);
}
[Benchmark]
public int StaticSwitchRequest1000()
{
return StaticSwitchHelper.Switch(Request1000);
}
}
}