Skip to content

Commit 3b4b275

Browse files
author
Petr Sramek
committed
refacroteed benchmarks
1 parent 2a3d861 commit 3b4b275

File tree

4 files changed

+24
-14
lines changed

4 files changed

+24
-14
lines changed

.github/workflows/dotnet.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ jobs:
6060
strategy:
6161
matrix:
6262
os: [ubuntu-latest, windows-latest, macos-latest]
63-
netversion: [7, 8, 9]
6463

6564
concurrency:
6665
group: benchmark
@@ -70,23 +69,26 @@ jobs:
7069

7170
steps:
7271
- uses: actions/checkout@v3
73-
- name: Setup .NET ${{ matrix.netversion }}
72+
- name: Setup .NET 7
7473
uses: actions/setup-dotnet@v3
7574
with:
76-
dotnet-version: ${{ matrix.netversion }}.x
77-
- name: Fix libssl
78-
if: ${{ matrix.netversion == 5 && matrix.os == 'ubuntu-latest' }}
79-
run: |
80-
wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.23_amd64.deb
81-
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.23_amd64.deb
75+
dotnet-version: 7.x
76+
- name: Setup .NET 8
77+
uses: actions/setup-dotnet@v3
78+
with:
79+
dotnet-version: 8.x
80+
- name: Setup .NET 9
81+
uses: actions/setup-dotnet@v3
82+
with:
83+
dotnet-version: 9.x
8284
- uses: actions/download-artifact@v4
8385
with:
8486
name: build
8587
path: .
8688
merge-multiple: true
8789
- name: Decode Benchmark
8890
working-directory: ./benchmarks/PolylineAlgorithm.Benchmarks
89-
run: dotnet run --configuration Release --framework net${{ matrix.netversion }}.0 --filter '*DecodeBenchmark*'
91+
run: dotnet run --configuration Release
9092
- name: Encode Benchmark
9193
working-directory: ./benchmarks/PolylineAlgorithm.Benchmarks
92-
run: dotnet run --configuration Release --framework net${{ matrix.netversion }}.0 --filter '*EncodeBenchmark*'
94+
run: dotnet run --configuration Release

benchmarks/PolylineAlgorithm.Benchmarks/DecodeBenchmark.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@ namespace PolylineAlgorithm.Benchmarks;
77

88
using BenchmarkDotNet.Attributes;
99
using BenchmarkDotNet.Engines;
10+
using BenchmarkDotNet.Jobs;
1011
using BenchmarkDotNet.Order;
1112
using Cloudikka.PolylineAlgorithm.Encoding;
1213
using PolylineAlgorithm;
1314
using PolylinerNet;
14-
using System.Collections.Generic;
1515

1616
[RankColumn]
1717
[MemoryDiagnoser]
18+
[SimpleJob(RuntimeMoniker.Net70, baseline: true)]
19+
[SimpleJob(RuntimeMoniker.Net80)]
20+
[SimpleJob(RuntimeMoniker.Net90)]
1821
[Orderer(SummaryOrderPolicy.Default)]
1922
public class DecodeBenchmark {
2023
private readonly Consumer _consumer = new();

benchmarks/PolylineAlgorithm.Benchmarks/EncodeBenchmark.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace PolylineAlgorithm.Benchmarks;
77

88
using BenchmarkDotNet.Attributes;
99
using BenchmarkDotNet.Engines;
10+
using BenchmarkDotNet.Jobs;
1011
using BenchmarkDotNet.Order;
1112
using Cloudikka.PolylineAlgorithm.Encoding;
1213
using PolylineAlgorithm;
@@ -15,6 +16,9 @@ namespace PolylineAlgorithm.Benchmarks;
1516

1617
[RankColumn]
1718
[MemoryDiagnoser]
19+
[SimpleJob(RuntimeMoniker.Net70, baseline: true)]
20+
[SimpleJob(RuntimeMoniker.Net80)]
21+
[SimpleJob(RuntimeMoniker.Net90)]
1822
[Orderer(SummaryOrderPolicy.Default)]
1923
public class EncodeBenchmark {
2024
public static IEnumerable<Coordinate> PolylineAlgorithm_Coordinates { get; } = [new(60.81071, -121.40005), new(70.05664, -38.43130), new(37.52379, -84.83755), new(41.85003, 26.25620), new(68.04709, 110.63120), new(61.48922, 50.16245), new(-4.46018, -58.11880), new(-32.16061, -3.27505), new(-50.89185, -55.30630), new(-28.52070, 90.94370), new(35.26009, 93.75620), new(54.83622, 128.91245), new(1.16022, 37.50620), new(-44.26398, -131.24380), new(-33.34325, 154.22495), new(-59.65879, 90.94370), new(-62.38215, 0.94370), new(72.32117, 40.31870), new(64.66910, 2.34995), new(-61.04971, -84.83755), new(77.10238, -91.86880), new(-72.88859, -129.83755), new(-69.24987, -24.36880), new(77.41254, 119.06870), new(-70.69409, 83.91245), new(78.85650, 75.47495), new(26.83989, 140.16245), new(-24.75069, -108.74380), new(30.53968, -145.30630), new(79.12503, 145.78745), new(-34.51006, 133.13120), new(-73.29753, -60.93130), new(-74.08712, 23.44370), new(-76.57404, 100.78745), new(-76.57404, 100.78745), new(39.72082, 103.59995), new(70.99412, 148.59995), new(82.27591, 138.75620), new(78.29964, -3.27505), new(78.29964, -3.27505), new(-8.65039, 47.34995)];

benchmarks/PolylineAlgorithm.Benchmarks/Program.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ namespace PolylineAlgorithm.Benchmarks;
99

1010
internal class Program {
1111
static void Main(string[] args) {
12-
BenchmarkSwitcher
13-
.FromAssembly(typeof(Program).Assembly)
14-
.Run(args);
12+
BenchmarkRunner
13+
.Run<EncodeBenchmark>();
14+
BenchmarkRunner
15+
.Run<DecodeBenchmark>();
1516
}
1617
}

0 commit comments

Comments
 (0)