Skip to content

Commit 46e607d

Browse files
authored
🧪Add PerfTests for startup and JIT comparing v4 and v5 (#1283)
Dump some tests used to benchmark #1126
1 parent 5f13d99 commit 46e607d

File tree

10 files changed

+94
-0
lines changed

10 files changed

+94
-0
lines changed

.config/dotnet-tools.json

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
"commands": [
88
"dotnet-dotcover"
99
]
10+
},
11+
"timeitsharp": {
12+
"version": "0.0.8",
13+
"commands": [
14+
"dotnet-timeit"
15+
]
1016
}
1117
}
1218
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net7.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
<RootNamespace>perftest</RootNamespace>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<ProjectReference Include="..\..\UnitsNet\UnitsNet.csproj" />
13+
</ItemGroup>
14+
15+
</Project>

PerfTests/PerfTest_Startup/Program.cs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
using UnitsNet;
2+
using UnitsNet.Units;
3+
4+
Console.WriteLine(Power.From(5, PowerUnit.Watt));

PerfTests/PerfTest_Startup/profile.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
# shellcheck disable=SC2155
3+
declare -r dirname=$(dirname -- "$0")
4+
5+
pushd "$dirname" || exit
6+
dotnet publish
7+
dotnet timeit "$dirname/timeit.json"
8+
popd || exit
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"warmUpCount": 10,
3+
"count": 20,
4+
"scenarios": [{ "name": "Default" }],
5+
"processName": "../../Artifacts/PerfTest_Startup/net7.0/PerfTest_Startup.exe",
6+
"workingDirectory": "$(CWD)/",
7+
"processTimeout": 15
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net7.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
<RootNamespace>perftest_before</RootNamespace>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="UnitsNet" Version="4.144.0" />
13+
</ItemGroup>
14+
15+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// See https://aka.ms/new-console-template for more information
2+
3+
using UnitsNet;
4+
using UnitsNet.Units;
5+
6+
Console.WriteLine(Power.From(5, PowerUnit.Watt));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
# shellcheck disable=SC2155
3+
declare -r dirname=$(dirname -- "$0")
4+
5+
pushd "$dirname" || exit
6+
dotnet publish
7+
dotnet timeit "$dirname/timeit.json"
8+
popd || exit
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"warmUpCount": 5,
3+
"count": 10,
4+
"scenarios": [{ "name": "Default" }],
5+
"processName": "../../Artifacts/PerfTest_Startup_v4_144_0/net7.0/PerfTest_Startup_v4_144_0.exe",
6+
"workingDirectory": "$(CWD)/",
7+
"processTimeout": 15
8+
}

UnitsNet.sln

+16
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{71C6EF60
5050
Build\init.ps1 = Build\init.ps1
5151
EndProjectSection
5252
EndProject
53+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PerfTest_Startup", "PerfTests\PerfTest_Startup\PerfTest_Startup.csproj", "{BFF3DD22-0F58-4E79-86CD-662D1A174224}"
54+
EndProject
55+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PerfTest_Startup_v4_144_0", "PerfTests\PerfTest_Startup_v4_144_0\PerfTest_Startup_v4_144_0.csproj", "{2E68C361-F6FA-49DC-BB0E-85ADE776391E}"
56+
EndProject
57+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PerfTests", "PerfTests", "{126F0393-A678-4609-9341-7028F1B2BC2B}"
58+
EndProject
5359
Global
5460
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5561
Debug|Any CPU = Debug|Any CPU
@@ -88,6 +94,14 @@ Global
8894
{B4996AF5-9A8B-481A-9018-EC7F5B1605FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
8995
{B4996AF5-9A8B-481A-9018-EC7F5B1605FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
9096
{B4996AF5-9A8B-481A-9018-EC7F5B1605FF}.Release|Any CPU.Build.0 = Release|Any CPU
97+
{BFF3DD22-0F58-4E79-86CD-662D1A174224}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
98+
{BFF3DD22-0F58-4E79-86CD-662D1A174224}.Debug|Any CPU.Build.0 = Debug|Any CPU
99+
{BFF3DD22-0F58-4E79-86CD-662D1A174224}.Release|Any CPU.ActiveCfg = Release|Any CPU
100+
{BFF3DD22-0F58-4E79-86CD-662D1A174224}.Release|Any CPU.Build.0 = Release|Any CPU
101+
{2E68C361-F6FA-49DC-BB0E-85ADE776391E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
102+
{2E68C361-F6FA-49DC-BB0E-85ADE776391E}.Debug|Any CPU.Build.0 = Debug|Any CPU
103+
{2E68C361-F6FA-49DC-BB0E-85ADE776391E}.Release|Any CPU.ActiveCfg = Release|Any CPU
104+
{2E68C361-F6FA-49DC-BB0E-85ADE776391E}.Release|Any CPU.Build.0 = Release|Any CPU
91105
EndGlobalSection
92106
GlobalSection(SolutionProperties) = preSolution
93107
HideSolutionNode = FALSE
@@ -97,5 +111,7 @@ Global
97111
EndGlobalSection
98112
GlobalSection(NestedProjects) = preSolution
99113
{71C6EF60-7E52-4DF4-BA93-5FAF6D89AEC6} = {B92B01BE-243E-4CCB-B5E5-AF469ADB1F54}
114+
{BFF3DD22-0F58-4E79-86CD-662D1A174224} = {126F0393-A678-4609-9341-7028F1B2BC2B}
115+
{2E68C361-F6FA-49DC-BB0E-85ADE776391E} = {126F0393-A678-4609-9341-7028F1B2BC2B}
100116
EndGlobalSection
101117
EndGlobal

0 commit comments

Comments
 (0)