@@ -136,9 +136,9 @@ private void AssertZeroResults(Type benchmarkType, IConfig config)
136
136
}
137
137
138
138
[ Fact ]
139
- public void LargeStructBenchmarksReportsNonZeroTimeAndZeroAllocated_InProcess ( )
139
+ public void DifferentSizedStructsBenchmarksReportsNonZeroTimeAndZeroAllocated_InProcess ( )
140
140
{
141
- AssertLargeStructResults ( ManualConfig . CreateEmpty ( )
141
+ AssertDifferentSizedStructsResults ( ManualConfig . CreateEmpty ( )
142
142
. AddJob ( Job . Default
143
143
. WithToolchain ( InProcessEmitToolchain . Instance )
144
144
) ) ;
@@ -147,9 +147,9 @@ public void LargeStructBenchmarksReportsNonZeroTimeAndZeroAllocated_InProcess()
147
147
[ TheoryNetCoreOnly ( "To not repeat tests in both full Framework and Core" ) ]
148
148
[ InlineData ( RuntimeMoniker . Net70 ) ]
149
149
[ InlineData ( RuntimeMoniker . Mono70 ) ]
150
- public void LargeStructBenchmarksReportsNonZeroTimeAndZeroAllocated_Core ( RuntimeMoniker runtimeMoniker )
150
+ public void DifferentSizedStructsBenchmarksReportsNonZeroTimeAndZeroAllocated_Core ( RuntimeMoniker runtimeMoniker )
151
151
{
152
- AssertLargeStructResults ( ManualConfig . CreateEmpty ( )
152
+ AssertDifferentSizedStructsResults ( ManualConfig . CreateEmpty ( )
153
153
. AddJob ( Job . Default
154
154
. WithRuntime ( runtimeMoniker . GetRuntime ( ) )
155
155
) ) ;
@@ -158,17 +158,17 @@ public void LargeStructBenchmarksReportsNonZeroTimeAndZeroAllocated_Core(Runtime
158
158
[ TheoryFullFrameworkOnly ( "Can only run full Framework and Mono tests from Framework host" ) ]
159
159
[ InlineData ( RuntimeMoniker . Net462 ) ]
160
160
[ InlineData ( RuntimeMoniker . Mono ) ]
161
- public void LargeStructBenchmarksReportsNonZeroTimeAndZeroAllocated_Framework ( RuntimeMoniker runtimeMoniker )
161
+ public void DifferentSizedStructsBenchmarksReportsNonZeroTimeAndZeroAllocated_Framework ( RuntimeMoniker runtimeMoniker )
162
162
{
163
- AssertLargeStructResults ( ManualConfig . CreateEmpty ( )
163
+ AssertDifferentSizedStructsResults ( ManualConfig . CreateEmpty ( )
164
164
. AddJob ( Job . Default
165
165
. WithRuntime ( runtimeMoniker . GetRuntime ( ) )
166
166
) ) ;
167
167
}
168
168
169
- private void AssertLargeStructResults ( IConfig config )
169
+ private void AssertDifferentSizedStructsResults ( IConfig config )
170
170
{
171
- var summary = CanExecute < LargeStruct > ( config
171
+ var summary = CanExecute < DifferentSizedStructs > ( config
172
172
. WithSummaryStyle ( SummaryStyle . Default . WithTimeUnit ( Perfolizer . Horology . TimeUnit . Nanosecond ) )
173
173
. AddDiagnoser ( new MemoryDiagnoser ( new MemoryDiagnoserConfig ( false ) ) )
174
174
) ;
@@ -201,18 +201,36 @@ private void AssertLargeStructResults(IConfig config)
201
201
}
202
202
}
203
203
204
- public class LargeStruct
204
+ public struct Struct16
205
205
{
206
- public struct Struct
207
- {
208
- // 128 bits
209
- public long l1 , l2 , l3 , l4 ,
210
- l5 , l6 , l7 , l8 ,
211
- l9 , l10 , l11 , l12 ,
212
- l13 , l14 , l15 , l16 ;
213
- }
206
+ public long l1 , l2 ;
207
+ }
214
208
215
- [ Benchmark ] public Struct Benchmark ( ) => default ;
209
+ public struct Struct32
210
+ {
211
+ public long l1 , l2 , l3 , l4 ;
212
+ }
213
+
214
+ public struct Struct64
215
+ {
216
+ public long l1 , l2 , l3 , l4 ,
217
+ l5 , l6 , l7 , l8 ;
218
+ }
219
+
220
+ public struct Struct128
221
+ {
222
+ public long l1 , l2 , l3 , l4 ,
223
+ l5 , l6 , l7 , l8 ,
224
+ l9 , l10 , l11 , l12 ,
225
+ l13 , l14 , l15 , l16 ;
226
+ }
227
+
228
+ public class DifferentSizedStructs
229
+ {
230
+ [ Benchmark ] public Struct16 Struct16 ( ) => default ;
231
+ [ Benchmark ] public Struct32 Struct32 ( ) => default ;
232
+ [ Benchmark ] public Struct64 Struct64 ( ) => default ;
233
+ [ Benchmark ] public Struct128 Struct128 ( ) => default ;
216
234
}
217
235
}
218
236
0 commit comments