@@ -7,10 +7,7 @@ namespace Open.Collections
77{
88 public class CollectionBenchmark < T > : BenchmarkBase < Func < ICollection < T > > >
99 {
10- public CollectionBenchmark ( uint size , uint repeat , Func < ICollection < T > > factory , Func < int , T > itemFactory ) : base ( size , repeat , factory )
11- {
12- _items = Enumerable . Range ( 0 , ( int ) TestSize * 2 ) . Select ( itemFactory ) . ToArray ( ) ;
13- }
10+ public CollectionBenchmark ( uint size , uint repeat , Func < ICollection < T > > factory , Func < int , T > itemFactory ) : base ( size , repeat , factory ) => _items = Enumerable . Range ( 0 , ( int ) TestSize * 2 ) . Select ( itemFactory ) . ToArray ( ) ;
1411
1512 protected readonly T [ ] _items ;
1613
@@ -85,17 +82,11 @@ public class CollectionBenchmark : CollectionBenchmark<object>
8582
8683 }
8784
88- public static TimedResult [ ] Results < T > ( uint size , uint repeat , Func < ICollection < T > > factory , Func < int , T > itemFactory )
89- {
90- return ( new CollectionBenchmark < T > ( size , repeat , factory , itemFactory ) ) . Result ;
91- }
85+ public static TimedResult [ ] Results < T > ( uint size , uint repeat , Func < ICollection < T > > factory , Func < int , T > itemFactory ) => ( new CollectionBenchmark < T > ( size , repeat , factory , itemFactory ) ) . Result ;
9286
9387
9488 public static TimedResult [ ] Results < T > ( uint size , uint repeat , Func < ICollection < T > > factory )
95- where T : new ( )
96- {
97- return ( new CollectionBenchmark < T > ( size , repeat , factory , i => new T ( ) ) ) . Result ;
98- }
89+ where T : new ( ) => ( new CollectionBenchmark < T > ( size , repeat , factory , i => new T ( ) ) ) . Result ;
9990
10091 }
10192}
0 commit comments