From 46e607d83137b5561dc8c83f7853e17483f6c5c7 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Tue, 11 Jul 2023 03:18:48 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AAAdd=20PerfTests=20for=20startup=20a?= =?UTF-8?q?nd=20JIT=20comparing=20v4=20and=20v5=20(#1283)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dump some tests used to benchmark #1126 --- .config/dotnet-tools.json | 6 ++++++ .../PerfTest_Startup/PerfTest_Startup.csproj | 15 +++++++++++++++ PerfTests/PerfTest_Startup/Program.cs | 4 ++++ PerfTests/PerfTest_Startup/profile.sh | 8 ++++++++ PerfTests/PerfTest_Startup/timeit.json | 8 ++++++++ .../PerfTest_Startup_v4_144_0.csproj | 15 +++++++++++++++ PerfTests/PerfTest_Startup_v4_144_0/Program.cs | 6 ++++++ PerfTests/PerfTest_Startup_v4_144_0/profile.sh | 8 ++++++++ PerfTests/PerfTest_Startup_v4_144_0/timeit.json | 8 ++++++++ UnitsNet.sln | 16 ++++++++++++++++ 10 files changed, 94 insertions(+) create mode 100644 PerfTests/PerfTest_Startup/PerfTest_Startup.csproj create mode 100644 PerfTests/PerfTest_Startup/Program.cs create mode 100644 PerfTests/PerfTest_Startup/profile.sh create mode 100644 PerfTests/PerfTest_Startup/timeit.json create mode 100644 PerfTests/PerfTest_Startup_v4_144_0/PerfTest_Startup_v4_144_0.csproj create mode 100644 PerfTests/PerfTest_Startup_v4_144_0/Program.cs create mode 100644 PerfTests/PerfTest_Startup_v4_144_0/profile.sh create mode 100644 PerfTests/PerfTest_Startup_v4_144_0/timeit.json diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 3b85b8cde1..e9d3dfb6dc 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -7,6 +7,12 @@ "commands": [ "dotnet-dotcover" ] + }, + "timeitsharp": { + "version": "0.0.8", + "commands": [ + "dotnet-timeit" + ] } } } \ No newline at end of file diff --git a/PerfTests/PerfTest_Startup/PerfTest_Startup.csproj b/PerfTests/PerfTest_Startup/PerfTest_Startup.csproj new file mode 100644 index 0000000000..fa16b7ff97 --- /dev/null +++ b/PerfTests/PerfTest_Startup/PerfTest_Startup.csproj @@ -0,0 +1,15 @@ + + + + Exe + net7.0 + enable + enable + perftest + + + + + + + diff --git a/PerfTests/PerfTest_Startup/Program.cs b/PerfTests/PerfTest_Startup/Program.cs new file mode 100644 index 0000000000..b54c226ab3 --- /dev/null +++ b/PerfTests/PerfTest_Startup/Program.cs @@ -0,0 +1,4 @@ +using UnitsNet; +using UnitsNet.Units; + +Console.WriteLine(Power.From(5, PowerUnit.Watt)); diff --git a/PerfTests/PerfTest_Startup/profile.sh b/PerfTests/PerfTest_Startup/profile.sh new file mode 100644 index 0000000000..1b145208f2 --- /dev/null +++ b/PerfTests/PerfTest_Startup/profile.sh @@ -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 diff --git a/PerfTests/PerfTest_Startup/timeit.json b/PerfTests/PerfTest_Startup/timeit.json new file mode 100644 index 0000000000..70e51efae8 --- /dev/null +++ b/PerfTests/PerfTest_Startup/timeit.json @@ -0,0 +1,8 @@ +{ + "warmUpCount": 10, + "count": 20, + "scenarios": [{ "name": "Default" }], + "processName": "../../Artifacts/PerfTest_Startup/net7.0/PerfTest_Startup.exe", + "workingDirectory": "$(CWD)/", + "processTimeout": 15 +} diff --git a/PerfTests/PerfTest_Startup_v4_144_0/PerfTest_Startup_v4_144_0.csproj b/PerfTests/PerfTest_Startup_v4_144_0/PerfTest_Startup_v4_144_0.csproj new file mode 100644 index 0000000000..562902a0c0 --- /dev/null +++ b/PerfTests/PerfTest_Startup_v4_144_0/PerfTest_Startup_v4_144_0.csproj @@ -0,0 +1,15 @@ + + + + Exe + net7.0 + enable + enable + perftest_before + + + + + + + diff --git a/PerfTests/PerfTest_Startup_v4_144_0/Program.cs b/PerfTests/PerfTest_Startup_v4_144_0/Program.cs new file mode 100644 index 0000000000..8bbbc94c42 --- /dev/null +++ b/PerfTests/PerfTest_Startup_v4_144_0/Program.cs @@ -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)); diff --git a/PerfTests/PerfTest_Startup_v4_144_0/profile.sh b/PerfTests/PerfTest_Startup_v4_144_0/profile.sh new file mode 100644 index 0000000000..6c2c05b7a7 --- /dev/null +++ b/PerfTests/PerfTest_Startup_v4_144_0/profile.sh @@ -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 \ No newline at end of file diff --git a/PerfTests/PerfTest_Startup_v4_144_0/timeit.json b/PerfTests/PerfTest_Startup_v4_144_0/timeit.json new file mode 100644 index 0000000000..70f799aa89 --- /dev/null +++ b/PerfTests/PerfTest_Startup_v4_144_0/timeit.json @@ -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 +} diff --git a/UnitsNet.sln b/UnitsNet.sln index 2fc4b119a7..85d9824e63 100644 --- a/UnitsNet.sln +++ b/UnitsNet.sln @@ -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 @@ -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 @@ -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