File tree 2 files changed +27
-1
lines changed
2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 6
6
<Nullable >enable</Nullable >
7
7
<LangVersion >preview</LangVersion >
8
8
<AllowUnsafeBlocks >true</AllowUnsafeBlocks >
9
- <TargetFrameworks >net8.0;net7.0</TargetFrameworks >
9
+ <TargetFrameworks >net8.0;net7.0;net6.0 </TargetFrameworks >
10
10
</PropertyGroup >
11
11
12
12
<ItemGroup >
Original file line number Diff line number Diff line change 9
9
10
10
[ SimpleJob ( RuntimeMoniker . Net70 , baseline : true ) ]
11
11
[ SimpleJob ( RuntimeMoniker . Net80 ) ]
12
+ [ SimpleJob ( RuntimeMoniker . Net60 ) ]
12
13
[ HideColumns ( Column . Job , Column . RatioSD ) ]
13
14
public class Benchmarks
14
15
{
@@ -62,4 +63,29 @@ public string InvokeMethodViaReflection()
62
63
63
64
[ Benchmark ]
64
65
public string [ ] EnumGetNames ( ) => Enum . GetNames < DayOfWeek > ( ) ;
66
+
67
+ [ Benchmark ]
68
+ public List < int > ListAdd1000 ( )
69
+ {
70
+ var list = new List < int > ( ) ;
71
+ for ( var i = 0 ; i < 1000 ; i ++ )
72
+ {
73
+ list . Add ( i ) ;
74
+ }
75
+
76
+ return list ;
77
+ }
78
+
79
+ [ Benchmark ]
80
+ public int ListLookup ( )
81
+ {
82
+ var entriesFound = 0 ;
83
+ for ( var i = 0 ; i < 100 ; i ++ )
84
+ {
85
+ if ( _numbers . Contains ( i ) )
86
+ entriesFound ++ ;
87
+ }
88
+
89
+ return entriesFound ;
90
+ }
65
91
}
You can’t perform that action at this time.
0 commit comments