Skip to content

Commit 479429a

Browse files
authored
update benchmarks to net6.0 (#1161)
1 parent a36b477 commit 479429a

File tree

6 files changed

+89
-91
lines changed

6 files changed

+89
-91
lines changed
Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,78 @@
11
name: UnitsNet Benchmarks (auto)
22
on:
33
push:
4-
branches: [master]
4+
branches: [master]
55
paths:
66
- "UnitsNet/*"
77
- "UnitsNet.Benchmark/*"
88
- ".github/workflows/**"
99
- ".github/actions/**"
10-
10+
1111
env:
12-
FRAMEWORK: net5.0
12+
FRAMEWORK: net6.0
1313
EXECUTION_OPTIONS: --iterationTime 500 --disableLogFile # see https://benchmarkdotnet.org/articles/guides/console-args.html
1414
BENCHMARK_PAGES_BRANCH: gh-pages
1515
BENCHMARK_DATA_FOLDER: benchmarks
16-
16+
1717
jobs:
1818
benchmark:
1919
if: github.repository_owner == 'angularsen' # (by default) the workflow doesn't need to run in a fork
2020
runs-on: windows-latest # required by the older frameworks
2121
strategy:
2222
# max-parallel: 1 # is it better to avoid running in parallel?
23-
matrix:
24-
runtime: ["netcoreapp50", "netcoreapp21", "net472"]
23+
matrix:
24+
runtime: ["net6.0", "netcoreapp21", "net472"]
2525
steps:
26-
- run: echo Starting benchmarks for ${{ matrix.runtime }}
27-
26+
- run: echo Starting benchmarks for ${{ matrix.runtime }}
27+
2828
# checkout the current branch
29-
- uses: actions/checkout@v2
30-
29+
- uses: actions/checkout@v2
30+
3131
# we need all frameworks (even if only running one target at a time)
3232
- uses: actions/setup-dotnet@v1
33-
with:
34-
dotnet-version: '2.1.x'
35-
33+
with:
34+
dotnet-version: "2.1.x"
35+
3636
- uses: actions/setup-dotnet@v1
37-
with:
38-
dotnet-version: '3.1.x'
39-
37+
with:
38+
dotnet-version: "3.1.x"
39+
4040
- uses: actions/setup-dotnet@v1
41-
with:
42-
dotnet-version: '5.0.x'
43-
44-
# executing the benchmark for the current framework, placing the result in a corresponding sub-folder
41+
with:
42+
dotnet-version: "5.0.x"
43+
44+
# executing the benchmark for the current framework, placing the result in a corresponding sub-folder
4545
- uses: ./.github/actions/run-benchmarks
4646
with:
4747
framework: ${{ env.FRAMEWORK }}
4848
runtimes: ${{ matrix.runtime }}
4949
output-folder: Artifacts/Benchmark/${{ matrix.runtime }}
5050
execution-options: ${{ env.EXECUTION_OPTIONS }}
51-
52-
# saving the current artifact (downloadable until the expiration date of this action)
51+
52+
# saving the current artifact (downloadable until the expiration date of this action)
5353
- name: Store benchmark artifact
5454
uses: actions/upload-artifact@v2
5555
with:
5656
name: UnitsNet Benchmarks (${{ matrix.runtime }})
5757
path: Artifacts/Benchmark/${{ matrix.runtime }}/results/
58-
58+
5959
publish-results:
6060
needs: [benchmark]
6161
runs-on: ubuntu-latest
6262
strategy:
6363
max-parallel: 1 # cannot commit on the same branch in parallel
64-
matrix:
65-
runtime: ["netcoreapp50", "netcoreapp21", "net472"]
66-
steps:
64+
matrix:
65+
runtime: ["net6.0", "netcoreapp21", "net472"]
66+
steps:
6767
- name: Initializing git folder ️
6868
uses: actions/[email protected]
6969

7070
- name: Download Artifacts # The benchmark results are downloaded into a 'runtime' folder.
7171
uses: actions/download-artifact@v1
7272
with:
7373
name: UnitsNet Benchmarks (${{ matrix.runtime }})
74-
path: ${{ matrix.runtime }}
75-
74+
path: ${{ matrix.runtime }}
75+
7676
# publishing the current results to the benchmark-pages branch (overriding the previous result)
7777
- name: Saving benchmark results to ${{ env.BENCHMARK_PAGES_BRANCH }}/${{ env.BENCHMARK_DATA_FOLDER }}/${{ matrix.runtime }}/results
7878
uses: JamesIves/[email protected]
@@ -81,22 +81,21 @@ jobs:
8181
branch: ${{ env.BENCHMARK_PAGES_BRANCH }}
8282
target-folder: ${{ env.BENCHMARK_DATA_FOLDER }}/${{ matrix.runtime }}/results
8383
commit-message: Automatic benchmark generation for ${{ github.sha }}
84-
84+
8585
# appending to the running benchmark data on the benchmark-pages branch
8686
- name: Updating benchmark charts
8787
uses: starburst997/[email protected]
8888
with:
8989
name: UnitsNet Benchmarks (${{ matrix.runtime }})
90-
tool: 'benchmarkdotnet'
90+
tool: "benchmarkdotnet"
9191
output-file-path: ${{ matrix.runtime }}/UnitsNet.Benchmark.UnitsNetBenchmarks-report-full.json
9292
gh-pages-branch: ${{ env.BENCHMARK_PAGES_BRANCH }}
9393
benchmark-data-dir-path: ${{ env.BENCHMARK_DATA_FOLDER }}/${{ matrix.runtime }}
9494
github-token: ${{ secrets.GITHUB_TOKEN }}
9595
auto-push: true
9696
# Show alert with commit comment on detecting possible performance regression
97-
alert-threshold: '200%'
97+
alert-threshold: "200%"
9898
comment-always: true
9999
comment-on-alert: true
100100
fail-on-alert: false
101-
alert-comment-cc-users: '@lipchev'
102-
101+
alert-comment-cc-users: "@lipchev"

.github/workflows/run-benchmarks.yml

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,67 +3,67 @@ on:
33
workflow_dispatch:
44
inputs:
55
benchmark-name:
6-
description: 'A name given for this benchmark'
6+
description: "A name given for this benchmark"
77
required: false
8-
default: 'UnitsNet Benchmarks'
8+
default: "UnitsNet Benchmarks"
99
runtimes:
10-
description: 'The runtime version to use (e.g. net472 net48 netcoreapp21 netcoreapp31 netcoreapp50)'
11-
default: net472 netcoreapp21 netcoreapp50
10+
description: "The runtime version to use (e.g. net472 net48 netcoreapp21 netcoreapp31 net6.0)"
11+
default: net472 netcoreapp21 net6.0
1212
required: true
1313
exporters:
14-
description: 'The exporter(s) used for this run (GitHub/StackOverflow/RPlot/CSV/JSON/HTML/XML)'
14+
description: "The exporter(s) used for this run (GitHub/StackOverflow/RPlot/CSV/JSON/HTML/XML)"
1515
required: false
1616
default: fulljson rplot
1717
filter:
18-
description: 'An optional class filter to apply'
18+
description: "An optional class filter to apply"
1919
required: false
20-
default: '*'
20+
default: "*"
2121
categories:
22-
description: 'An optional categories filter to apply'
22+
description: "An optional categories filter to apply"
2323
required: false
24-
default: ''
24+
default: ""
2525
execution-options:
26-
description: 'Any additional parameters passed to the benchmark'
26+
description: "Any additional parameters passed to the benchmark"
2727
required: false
28-
default: --disableLogFile
28+
default: --disableLogFile
2929
comparison-baseline:
30-
description: 'Compare against a previous result (expecting a link to *-report-full.json)'
30+
description: "Compare against a previous result (expecting a link to *-report-full.json)"
3131
required: true
32-
default: 'https://angularsen.github.io/UnitsNet/benchmarks/netcoreapp50/results/UnitsNet.Benchmark.UnitsNetBenchmarks-report-full.json'
32+
default: "https://angularsen.github.io/UnitsNet/benchmarks/netcoreapp50/results/UnitsNet.Benchmark.UnitsNetBenchmarks-report-full.json"
3333
comparison-threshold:
34-
description: 'The (comparison) threshold for Statistical Test. Examples: 5%, 10ms, 100ns, 1s'
34+
description: "The (comparison) threshold for Statistical Test. Examples: 5%, 10ms, 100ns, 1s"
3535
required: false
36-
default: '1%'
36+
default: "1%"
3737
comparison-top:
38-
description: 'Filter the comparison to the top/bottom N results'
38+
description: "Filter the comparison to the top/bottom N results"
3939
required: false
40-
default: 10
40+
default: 10
4141
framework:
42-
description: 'The dotnet-version version to use (e.g. net5.0)'
43-
default: 'net5.0'
44-
required: true
42+
description: "The dotnet-version version to use (e.g. net6.0)"
43+
default: "net6.0"
44+
required: true
4545
jobs:
4646
benchmark:
4747
env:
4848
OUTPUT_FOLDER: Artifacts/Benchmarks/${{ github.event.inputs.benchmark-name }}
4949
runs-on: windows-latest
50-
steps:
50+
steps:
5151
# checkout the current branch
52-
- uses: actions/checkout@v2
53-
52+
- uses: actions/checkout@v2
53+
5454
# we need all frameworks (even if only running one target at a time)
5555
- uses: actions/setup-dotnet@v1
5656
with:
57-
dotnet-version: '2.1.x'
58-
57+
dotnet-version: "2.1.x"
58+
5959
- uses: actions/setup-dotnet@v1
6060
with:
61-
dotnet-version: '3.1.x'
62-
61+
dotnet-version: "3.1.x"
62+
6363
- uses: actions/setup-dotnet@v1
6464
with:
65-
dotnet-version: '5.0.x'
66-
65+
dotnet-version: "5.0.x"
66+
6767
# executing the benchmark for the current framework(s), placing the result in the output-folder
6868
- uses: ./.github/actions/run-benchmarks
6969
with:
@@ -73,70 +73,69 @@ jobs:
7373
filter: ${{ github.event.inputs.filter }}
7474
categories: ${{ github.event.inputs.categories }}
7575
execution-options: ${{ github.event.inputs.execution-options }}
76-
77-
# saving the current artifact (downloadable until the expiration date of this action)
76+
77+
# saving the current artifact (downloadable until the expiration date of this action)
7878
- name: Store benchmark result
7979
uses: actions/upload-artifact@v2
8080
with:
8181
name: ${{ github.event.inputs.benchmark-name }} (${{ github.event.inputs.runtimes }})
8282
path: ${{ env.OUTPUT_FOLDER }}/results
83-
if-no-files-found: error
84-
83+
if-no-files-found: error
84+
8585
compare-results:
8686
if: ${{ endsWith(github.event.inputs.comparison-baseline, '-report-full.json') }}
8787
env:
8888
OUPUT_NAME: Baseline vs ${{ github.event.inputs.benchmark-name }} (${{ github.event.inputs.runtimes }})
8989
needs: [benchmark]
9090
runs-on: ubuntu-latest
91-
steps:
92-
# The baseline results are downloaded into a 'baseline' folder.
91+
steps:
92+
# The baseline results are downloaded into a 'baseline' folder.
9393
- name: Download Baseline
9494
uses: carlosperate/[email protected]
9595
with:
9696
file-url: ${{ github.event.inputs.comparison-baseline }}
9797
location: baseline
98-
99-
# The benchmark results are downloaded into a 'runtime' folder.
100-
- name: Download Artifacts
98+
99+
# The benchmark results are downloaded into a 'runtime' folder.
100+
- name: Download Artifacts
101101
uses: actions/download-artifact@v1
102102
with:
103103
name: ${{ github.event.inputs.benchmark-name }} (${{ github.event.inputs.runtimes }})
104-
path: results
105-
104+
path: results
105+
106106
# The benchmark comparer is currently taken from dotnet/performance/src/tools/ResultsComparer (hoping that a 'tool' would eventually be made available)
107107
- name: Download ResultsComparer
108108
uses: actions/checkout@v2
109109
with:
110110
repository: dotnet/performance
111111
path: comparer
112-
112+
113113
- uses: actions/setup-dotnet@v1
114114
with:
115-
dotnet-version: '3.1.x'
116-
115+
dotnet-version: "3.1.x"
116+
117117
- run: mkdir -p artifacts
118-
118+
119119
# Executing the comparer, placing the result in a 'comparison' folder (as well as creating a summary from the output)
120120
- name: Running the ResultsComparer
121121
env:
122-
PERFLAB_TARGET_FRAMEWORKS: netcoreapp3.1
123-
run: >
122+
PERFLAB_TARGET_FRAMEWORKS: net6.0
123+
run: >
124124
dotnet run --project 'comparer/src/tools/ResultsComparer' -c Release
125-
--framework netcoreapp31
125+
--framework net6.0
126126
--base baseline --diff results
127127
--csv "artifacts/${{ env.OUPUT_NAME }}.csv"
128128
--xml "artifacts/${{ env.OUPUT_NAME }}.xml"
129129
--threshold ${{ github.event.inputs.comparison-threshold }}
130130
--top ${{ github.event.inputs.comparison-top }}
131131
> "artifacts/${{ env.OUPUT_NAME }}.md"
132-
132+
133133
- name: Summary
134134
run: cat "artifacts/${{ env.OUPUT_NAME }}.md"
135-
136-
# saving the current artifacts (downloadable until the expiration date of this action)
135+
136+
# saving the current artifacts (downloadable until the expiration date of this action)
137137
- name: Store comparison result
138138
uses: actions/upload-artifact@v2
139139
with:
140140
name: ${{ env.OUPUT_NAME }}
141141
path: artifacts
142-

CodeGen/CodeGen.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp6.0</TargetFramework>
5+
<TargetFramework>net6.0</TargetFramework>
66
<LangVersion>latest</LangVersion>
77
<Nullable>enable</Nullable>
88
<!-- Allow compile with various nullability warnings until fixed. -->

UnitsNet.Benchmark/Scripts/json-export-all-runtimes.bat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ SET projectdir="%scriptdir%..\.."
44
SET exportdir="%projectdir%\Artifacts\Benchmark"
55
:: this fails on the build server (also tested with the nightly benchmark.net package: 0.12.1.1533): possibly related to https://github.com/dotnet/BenchmarkDotNet/issues/1487
66
dotnet run --project "%projectdir%/UnitsNet.Benchmark" -c Release ^
7-
--framework net5.0 ^
8-
--runtimes net472 net48 netcoreapp2.1 netcoreapp3.1 netcoreapp50 ^
7+
--framework net6.0 ^
8+
--runtimes net472 net48 netcoreapp2.1 netcoreapp3.1 net6.0 ^
99
--artifacts=%exportdir% ^
1010
--exporters json ^
1111
--filter * ^
@@ -14,4 +14,4 @@ dotnet run --project "%projectdir%/UnitsNet.Benchmark" -c Release ^
1414
--join %1 %2 %3
1515

1616
:: this runs fine, however there is currently no way of displaying multiple-lines-per-chart: see https://github.com/rhysd/github-action-benchmark/issues/18
17-
:: dotnet run --project "%scriptdir%/UnitsNet.Benchmark" -c Release -f net5.0 --runtimes netcoreapp31 netcoreapp50 --filter ** --artifacts="%scriptdir%/Artifacts/Benchmark" --exporters json
17+
:: dotnet run --project "%scriptdir%/UnitsNet.Benchmark" -c Release -f net6.0 --runtimes netcoreapp31 netcoreapp50 --filter ** --artifacts="%scriptdir%/Artifacts/Benchmark" --exporters json

UnitsNet.Benchmark/Scripts/json-export-net5.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ SET exportdir="%projectdir%\Artifacts\Benchmark"
55
:: this fails on the build server (also tested with the nightly benchmark.net package: 0.12.1.1533): possibly related to https://github.com/dotnet/BenchmarkDotNet/issues/1487
66
dotnet run --project "%projectdir%\UnitsNet.Benchmark" -c Release ^
77
--framework net5.0 ^
8-
--runtimes netcoreapp50 ^
8+
--runtimes net5.0 ^
99
--artifacts=%exportdir% ^
1010
--exporters json ^
1111
--filter * ^
@@ -14,4 +14,4 @@ dotnet run --project "%projectdir%\UnitsNet.Benchmark" -c Release ^
1414
--join %1 %2 %3
1515

1616
:: this runs fine, however there is currently no way of displaying multiple-lines-per-chart: see https://github.com/rhysd/github-action-benchmark/issues/18
17-
:: dotnet run --project "%scriptdir%/UnitsNet.Benchmark" -c Release -f net5.0 --runtimes netcoreapp31 netcoreapp50 --filter ** --artifacts="%scriptdir%/Artifacts/Benchmark" --exporters json
17+
:: dotnet run --project "%scriptdir%/UnitsNet.Benchmark" -c Release -f net5.0 --runtimes netcoreapp31 net5.0 --filter ** --artifacts="%scriptdir%/Artifacts/Benchmark" --exporters json

UnitsNet.Benchmark/Scripts/r-plot-all-runtimes.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ SET exportdir="%projectdir%\Artifacts\Benchmark"
55
:: this fails on the build server (also tested with the nightly benchmark.net package: 0.12.1.1533): possibly related to https://github.com/dotnet/BenchmarkDotNet/issues/1487
66
dotnet run --project "%projectdir%\UnitsNet.Benchmark" -c Release ^
77
--framework net5.0 ^
8-
--runtimes net472 net48 netcoreapp2.1 netcoreapp3.1 netcoreapp50 ^
8+
--runtimes net472 net48 netcoreapp2.1 netcoreapp3.1 net6.0 ^
99
--artifacts=%exportdir% ^
1010
--exporters rplot ^
1111
--filter * ^

0 commit comments

Comments
 (0)