@@ -136,9 +136,9 @@ private void AssertZeroResults(Type benchmarkType, IConfig config)
136136 }
137137
138138 [ Fact ]
139- public void LargeStructBenchmarksReportsNonZeroTimeAndZeroAllocated_InProcess ( )
139+ public void DifferentSizedStructsBenchmarksReportsNonZeroTimeAndZeroAllocated_InProcess ( )
140140 {
141- AssertLargeStructResults ( ManualConfig . CreateEmpty ( )
141+ AssertDifferentSizedStructsResults ( ManualConfig . CreateEmpty ( )
142142 . AddJob ( Job . Default
143143 . WithToolchain ( InProcessEmitToolchain . Instance )
144144 ) ) ;
@@ -147,9 +147,9 @@ public void LargeStructBenchmarksReportsNonZeroTimeAndZeroAllocated_InProcess()
147147 [ TheoryNetCoreOnly ( "To not repeat tests in both full Framework and Core" ) ]
148148 [ InlineData ( RuntimeMoniker . Net70 ) ]
149149 [ InlineData ( RuntimeMoniker . Mono70 ) ]
150- public void LargeStructBenchmarksReportsNonZeroTimeAndZeroAllocated_Core ( RuntimeMoniker runtimeMoniker )
150+ public void DifferentSizedStructsBenchmarksReportsNonZeroTimeAndZeroAllocated_Core ( RuntimeMoniker runtimeMoniker )
151151 {
152- AssertLargeStructResults ( ManualConfig . CreateEmpty ( )
152+ AssertDifferentSizedStructsResults ( ManualConfig . CreateEmpty ( )
153153 . AddJob ( Job . Default
154154 . WithRuntime ( runtimeMoniker . GetRuntime ( ) )
155155 ) ) ;
@@ -158,17 +158,17 @@ public void LargeStructBenchmarksReportsNonZeroTimeAndZeroAllocated_Core(Runtime
158158 [ TheoryFullFrameworkOnly ( "Can only run full Framework and Mono tests from Framework host" ) ]
159159 [ InlineData ( RuntimeMoniker . Net462 ) ]
160160 [ InlineData ( RuntimeMoniker . Mono ) ]
161- public void LargeStructBenchmarksReportsNonZeroTimeAndZeroAllocated_Framework ( RuntimeMoniker runtimeMoniker )
161+ public void DifferentSizedStructsBenchmarksReportsNonZeroTimeAndZeroAllocated_Framework ( RuntimeMoniker runtimeMoniker )
162162 {
163- AssertLargeStructResults ( ManualConfig . CreateEmpty ( )
163+ AssertDifferentSizedStructsResults ( ManualConfig . CreateEmpty ( )
164164 . AddJob ( Job . Default
165165 . WithRuntime ( runtimeMoniker . GetRuntime ( ) )
166166 ) ) ;
167167 }
168168
169- private void AssertLargeStructResults ( IConfig config )
169+ private void AssertDifferentSizedStructsResults ( IConfig config )
170170 {
171- var summary = CanExecute < LargeStruct > ( config
171+ var summary = CanExecute < DifferentSizedStructs > ( config
172172 . WithSummaryStyle ( SummaryStyle . Default . WithTimeUnit ( Perfolizer . Horology . TimeUnit . Nanosecond ) )
173173 . AddDiagnoser ( new MemoryDiagnoser ( new MemoryDiagnoserConfig ( false ) ) )
174174 ) ;
@@ -201,18 +201,36 @@ private void AssertLargeStructResults(IConfig config)
201201 }
202202 }
203203
204- public class LargeStruct
204+ public struct Struct16
205205 {
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+ }
214208
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 ;
216234 }
217235}
218236
0 commit comments