too simple C# aot program
source code
/* The Computer Language Benchmarks Game
https://salsa.debian.org/benchmarksgame-team/benchmarksgame/
*/
class TooSimple {
public static void Main(String[] args) {
// mtime side-effect
using (FileStream fs = File.Create("./one")) { }
long n = Int64.Parse(args[0]);
double sum = 0.0;
double flip = -1.0;
for (long i = 1; i <= n; i++) {
flip *= -1.0;
sum += flip / (2*i - 1);
}
Console.WriteLine("{0:f9}", sum*4.0);
// mtime side-effect
using (FileStream fs = File.Create("./two")) { }
}
}
notes, command-line, and program output
NOTES:
64-bit Ubuntu quad core
.NET SDK 9.0.100
Host Version: 9.0.0
Commit: 9d5a6a9aa4
<OutputType>Exe
<TargetFramework>net9.0
<ImplicitUsings>enable
<Nullable>enable
<AllowUnsafeBlocks>true
<ServerGarbageCollection>true
<ConcurrentGarbageCollection>true
<PublishAot>true
<OptimizationPreference>Speed
<IlcInstructionSet>native
Thu, 14 Nov 2024 01:33:51 GMT
MAKE:
cp toosimple.csharpaot Program.cs
cp Include/csharpaot/program.csproj .
mkdir obj
cp Include/csharpaot/project.assets.json ./obj
/opt/src/dotnet-sdk-9.0.100/dotnet publish
Determining projects to restore...
Restored /home/dunham/all-benchmarksgame/benchmarksgame_i53330/toosimple/tmp/program.csproj (in 943 ms).
program -> /home/dunham/all-benchmarksgame/benchmarksgame_i53330/toosimple/tmp/bin/Release/net9.0/linux-x64/program.dll
Generating native code
program -> /home/dunham/all-benchmarksgame/benchmarksgame_i53330/toosimple/tmp/bin/Release/net9.0/linux-x64/publish/
24.93s to complete and log all make actions
COMMAND LINE:
./bin/Release/net9.0/linux-x64/native/program 10000000000
PROGRAM OUTPUT:
3.141592653