mirror of
https://github.com/vlang/v.git
synced 2025-09-08 06:41:58 -04:00
bench/vectors: add instructions on how to run the C# original code with dotnet run
, format vectors.cs with dotnet format
This commit is contained in:
parent
c44a89649a
commit
88cac9bdf4
@ -1,3 +1,22 @@
|
||||
Running the C# example:
|
||||
```
|
||||
dotnet run
|
||||
```
|
||||
|
||||
Running the V program:
|
||||
```
|
||||
v crun vectors.v
|
||||
```
|
||||
|
||||
Running the V program, compiled with -prod:
|
||||
```
|
||||
v -prod crun vectors.v
|
||||
```
|
||||
|
||||
Note: the `crun` will make sure that the compilation will happen just
|
||||
once at the start, and then the executable will be just reused by the
|
||||
subsequent commands with identical options.
|
||||
|
||||
```bash
|
||||
Benchmark 1: ./boids_test/bin/Release/net7.0/linux-x64/publish/boids_test
|
||||
Time (mean ± σ): 262.2 ms ± 5.7 ms [User: 231.6 ms, System: 14.1 ms]
|
||||
|
@ -1,3 +1,5 @@
|
||||
using System;
|
||||
|
||||
internal readonly struct Vector
|
||||
{
|
||||
public readonly double X;
|
||||
@ -17,9 +19,10 @@ internal readonly struct Vector
|
||||
}
|
||||
}
|
||||
|
||||
internal static class Program
|
||||
|
||||
class Program
|
||||
{
|
||||
public static void Main()
|
||||
static void Main(string[] args)
|
||||
{
|
||||
const int boidsCount = 10000;
|
||||
|
||||
@ -187,3 +190,4 @@ internal static class Program
|
||||
Console.WriteLine(velocitySum.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
14
bench/vectors/vectors.csproj
Normal file
14
bench/vectors/vectors.csproj
Normal file
@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<SelfContained>true</SelfContained>
|
||||
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Exe</OutputType>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
1
bench/vectors/vectors.runtimeconfig.json
Normal file
1
bench/vectors/vectors.runtimeconfig.json
Normal file
@ -0,0 +1 @@
|
||||
{"runtimeOptions":{"framework":{"name":"Microsoft.NETCore.App","version":"7.0.10"}}}
|
Loading…
x
Reference in New Issue
Block a user