Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧪Add PerfTests for startup and JIT comparing v4 and v5 #1283

Merged
merged 1 commit into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"commands": [
"dotnet-dotcover"
]
},
"timeitsharp": {
"version": "0.0.8",
"commands": [
"dotnet-timeit"
]
}
}
}
15 changes: 15 additions & 0 deletions PerfTests/PerfTest_Startup/PerfTest_Startup.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>perftest</RootNamespace>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\UnitsNet\UnitsNet.csproj" />
</ItemGroup>

</Project>
4 changes: 4 additions & 0 deletions PerfTests/PerfTest_Startup/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using UnitsNet;
using UnitsNet.Units;

Console.WriteLine(Power.From(5, PowerUnit.Watt));
8 changes: 8 additions & 0 deletions PerfTests/PerfTest_Startup/profile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
# shellcheck disable=SC2155
declare -r dirname=$(dirname -- "$0")

pushd "$dirname" || exit
dotnet publish
dotnet timeit "$dirname/timeit.json"
popd || exit
8 changes: 8 additions & 0 deletions PerfTests/PerfTest_Startup/timeit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"warmUpCount": 10,
"count": 20,
"scenarios": [{ "name": "Default" }],
"processName": "../../Artifacts/PerfTest_Startup/net7.0/PerfTest_Startup.exe",
"workingDirectory": "$(CWD)/",
"processTimeout": 15
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>perftest_before</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="UnitsNet" Version="4.144.0" />
</ItemGroup>

</Project>
6 changes: 6 additions & 0 deletions PerfTests/PerfTest_Startup_v4_144_0/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// See https://aka.ms/new-console-template for more information

using UnitsNet;
using UnitsNet.Units;

Console.WriteLine(Power.From(5, PowerUnit.Watt));
8 changes: 8 additions & 0 deletions PerfTests/PerfTest_Startup_v4_144_0/profile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
# shellcheck disable=SC2155
declare -r dirname=$(dirname -- "$0")

pushd "$dirname" || exit
dotnet publish
dotnet timeit "$dirname/timeit.json"
popd || exit
8 changes: 8 additions & 0 deletions PerfTests/PerfTest_Startup_v4_144_0/timeit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"warmUpCount": 5,
"count": 10,
"scenarios": [{ "name": "Default" }],
"processName": "../../Artifacts/PerfTest_Startup_v4_144_0/net7.0/PerfTest_Startup_v4_144_0.exe",
"workingDirectory": "$(CWD)/",
"processTimeout": 15
}
16 changes: 16 additions & 0 deletions UnitsNet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{71C6EF60
Build\init.ps1 = Build\init.ps1
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PerfTest_Startup", "PerfTests\PerfTest_Startup\PerfTest_Startup.csproj", "{BFF3DD22-0F58-4E79-86CD-662D1A174224}"
EndProject
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}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PerfTests", "PerfTests", "{126F0393-A678-4609-9341-7028F1B2BC2B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -88,6 +94,14 @@ Global
{B4996AF5-9A8B-481A-9018-EC7F5B1605FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B4996AF5-9A8B-481A-9018-EC7F5B1605FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B4996AF5-9A8B-481A-9018-EC7F5B1605FF}.Release|Any CPU.Build.0 = Release|Any CPU
{BFF3DD22-0F58-4E79-86CD-662D1A174224}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BFF3DD22-0F58-4E79-86CD-662D1A174224}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BFF3DD22-0F58-4E79-86CD-662D1A174224}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BFF3DD22-0F58-4E79-86CD-662D1A174224}.Release|Any CPU.Build.0 = Release|Any CPU
{2E68C361-F6FA-49DC-BB0E-85ADE776391E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E68C361-F6FA-49DC-BB0E-85ADE776391E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E68C361-F6FA-49DC-BB0E-85ADE776391E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E68C361-F6FA-49DC-BB0E-85ADE776391E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -97,5 +111,7 @@ Global
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{71C6EF60-7E52-4DF4-BA93-5FAF6D89AEC6} = {B92B01BE-243E-4CCB-B5E5-AF469ADB1F54}
{BFF3DD22-0F58-4E79-86CD-662D1A174224} = {126F0393-A678-4609-9341-7028F1B2BC2B}
{2E68C361-F6FA-49DC-BB0E-85ADE776391E} = {126F0393-A678-4609-9341-7028F1B2BC2B}
EndGlobalSection
EndGlobal