File tree 8 files changed +42
-26
lines changed
hello-world/csharp/legacy
8 files changed +42
-26
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ var runMs = int . Parse ( args [ 0 ] ) ;
2
+ var warmupMs = int . Parse ( args [ 1 ] ) ;
3
+ var n = int . Parse ( args [ 2 ] ) ;
4
+
5
+ Benchmark < int > . Run ( ( ) => Fibonacci ( n ) , warmupMs ) ;
6
+
7
+ var result = Benchmark < int > . Run ( ( ) => Fibonacci ( n ) , runMs ) ;
8
+
9
+ Console . WriteLine ( result ) ;
10
+
11
+ return ;
12
+
13
+ static int Fibonacci ( int n ) =>
14
+ n <= 1 ? n : Fibonacci ( n - 1 ) + Fibonacci ( n - 2 ) ;
Original file line number Diff line number Diff line change
1
+ <Project Sdk =" Microsoft.NET.Sdk" >
2
+
3
+ <PropertyGroup >
4
+ <OutputType >Exe</OutputType >
5
+ <TargetFramework >net9.0</TargetFramework >
6
+ <ImplicitUsings >enable</ImplicitUsings >
7
+ <Nullable >enable</Nullable >
8
+ </PropertyGroup >
9
+
10
+ <ItemGroup >
11
+ <Compile Include =" ..\..\..\lib\csharp\benchmark.cs" >
12
+ <Link >benchmark.cs</Link >
13
+ </Compile >
14
+ </ItemGroup >
15
+
16
+ </Project >
Original file line number Diff line number Diff line change
1
+ static int Fibonacci ( int n ) =>
2
+ n <= 1 ? n : Fibonacci ( n - 1 ) + Fibonacci ( n - 2 ) ;
3
+
4
+ var u = int . Parse ( args [ 0 ] ) ;
5
+ var r = 0 ;
6
+ for ( var i = 1 ; i < u ; i ++ )
7
+ {
8
+ r += Fibonacci ( i ) ;
9
+ }
10
+ Console . WriteLine ( r ) ;
Original file line number Diff line number Diff line change 7
7
<Nullable >enable</Nullable >
8
8
</PropertyGroup >
9
9
10
- <ItemGroup >
11
- <Compile Include =" ..\..\lib\csharp\Benchmark.cs" >
12
- <Link >Benchmark.cs</Link >
13
- </Compile >
14
- </ItemGroup >
15
-
16
- </Project >
10
+ </Project >
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ Console . WriteLine ( "Hello, World!" ) ;
Original file line number Diff line number Diff line change 7
7
<Nullable >enable</Nullable >
8
8
</PropertyGroup >
9
9
10
- <ItemGroup >
11
- <Compile Include =" ..\..\lib\csharp\Benchmark.cs" >
12
- <Link >Benchmark.cs</Link >
13
- </Compile >
14
- </ItemGroup >
15
-
16
10
</Project >
You can’t perform that action at this time.
0 commit comments