Skip to content

Commit 741f467

Browse files
author
Petr Sramek
committed
refactored
1 parent 86c6c5f commit 741f467

38 files changed

+871
-811
lines changed

PolylineAlgorithm.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PolylineAlgorithm.Dependenc
3131
EndProject
3232
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PolylineAlgorithm.DependencyInjection.Microsoft", "src\PolylineAlgorithm.DependencyInjection.Microsoft\PolylineAlgorithm.DependencyInjection.Microsoft.csproj", "{2B0061B3-7B80-4101-9FF0-AD513AE4C4E5}"
3333
EndProject
34+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PolylineAlgorithm.NetTopologySuite", "src\PolylineAlgorithm.NetTopologySuite\PolylineAlgorithm.NetTopologySuite.csproj", "{A5F4D456-3949-4146-95D2-E0208EEF207A}"
35+
EndProject
3436
Global
3537
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3638
Debug|Any CPU = Debug|Any CPU
@@ -69,6 +71,10 @@ Global
6971
{2B0061B3-7B80-4101-9FF0-AD513AE4C4E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
7072
{2B0061B3-7B80-4101-9FF0-AD513AE4C4E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
7173
{2B0061B3-7B80-4101-9FF0-AD513AE4C4E5}.Release|Any CPU.Build.0 = Release|Any CPU
74+
{A5F4D456-3949-4146-95D2-E0208EEF207A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
75+
{A5F4D456-3949-4146-95D2-E0208EEF207A}.Debug|Any CPU.Build.0 = Debug|Any CPU
76+
{A5F4D456-3949-4146-95D2-E0208EEF207A}.Release|Any CPU.ActiveCfg = Release|Any CPU
77+
{A5F4D456-3949-4146-95D2-E0208EEF207A}.Release|Any CPU.Build.0 = Release|Any CPU
7278
EndGlobalSection
7379
GlobalSection(SolutionProperties) = preSolution
7480
HideSolutionNode = FALSE
@@ -82,6 +88,7 @@ Global
8288
{F9CFF4B1-C9AB-4F94-ADF4-B29925E1187E} = {576FEFFC-B624-40C3-A8AF-4E5233802EA0}
8389
{9C1088DA-DBF7-4374-9775-C7613CCA98D8} = {51C886AF-D610-48A4-9D73-2DEB38742801}
8490
{2B0061B3-7B80-4101-9FF0-AD513AE4C4E5} = {51C886AF-D610-48A4-9D73-2DEB38742801}
91+
{A5F4D456-3949-4146-95D2-E0208EEF207A} = {51C886AF-D610-48A4-9D73-2DEB38742801}
8592
EndGlobalSection
8693
GlobalSection(ExtensibilityGlobals) = postSolution
8794
SolutionGuid = {93A268DC-0947-4FBB-B495-DDAD4B013D82}

benchmarks/PolylineAlgorithm.Benchmarks/PolylineAlgorithm.Benchmarks.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>net9.0</TargetFramework>
5+
<TargetFrameworks>net5.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
66
<LangVersion>13.0</LangVersion>
77
<Nullable>enable</Nullable>
88
<ImplicitUsings>enable</ImplicitUsings>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//
2+
// Copyright (c) Pete Sramek. All rights reserved.
3+
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
4+
//
5+
6+
namespace PolylineAlgorithm.Benchmarks;
7+
8+
using BenchmarkDotNet.Attributes;
9+
using BenchmarkDotNet.Engines;
10+
using BenchmarkDotNet.Jobs;
11+
using System.Collections.Generic;
12+
13+
[RankColumn]
14+
[MemoryDiagnoser]
15+
[SimpleJob(RuntimeMoniker.Net50, baseline: true)]
16+
[SimpleJob(RuntimeMoniker.Net60)]
17+
[SimpleJob(RuntimeMoniker.Net70)]
18+
[SimpleJob(RuntimeMoniker.Net80)]
19+
[SimpleJob(RuntimeMoniker.Net90)]
20+
[Orderer(BenchmarkDotNet.Order.SummaryOrderPolicy.Declared)]
21+
public class PolylineBenchmark {
22+
private readonly Consumer _consumer = new();
23+
24+
public DefaultPolylineDecoder Decoder { get; } = new DefaultPolylineDecoder();
25+
public Polyline Polyline { get; } = new Polyline("}adrJh}}cVazlw@uykyNhaqeE`vfzG_~kY}~`eTsr{~Cwn~aOty_g@thapJvvoqKxt{sStfahDmtvmIfmiqBhjq|HujpgComs{Z}dhdKcidPymnvBqmquE~qrfI`x{lPf|ftGn~}d_@q}saAurjmu@bwr_DxrfaK~{rO~bidPwfduXwlioFlpum@twvfFpmi~VzxcsOqyejYhh|i@pbnr[twvfF_ueUujvbSa_d~ZkcnjZla~f[pmquEebxo[j}nr@xnn|H{gyiKbh{yH`oenn@y{mpIrbd~EmipgH}fuov@hjqtTp|flAttvkFrym_d@|eyCwn~aOfvdNmeawM??{yxdUcidPca{}D_atqGenzcAlra{@trgWhn{aZ??tluqOgu~sH");
26+
27+
[Benchmark]
28+
public Span<Coordinate> Decode()
29+
=> Decoder
30+
.Decode(Polyline);
31+
32+
public DefaultPolylineEncoder Encoder { get; } = new DefaultPolylineEncoder();
33+
34+
public IEnumerable<Coordinate> Coordinates { get; } = [Coordinate.Create(60.81071, -121.40005), Coordinate.Create(70.05664, -38.43130), Coordinate.Create(37.52379, -84.83755), Coordinate.Create(41.85003, 26.25620), Coordinate.Create(68.04709, 110.63120), Coordinate.Create(61.48922, 50.16245), Coordinate.Create(-4.46018, -58.11880), Coordinate.Create(-32.16061, -3.27505), Coordinate.Create(-50.89185, -55.30630), Coordinate.Create(-28.52070, 90.94370), Coordinate.Create(35.26009, 93.75620), Coordinate.Create(54.83622, 128.91245), Coordinate.Create(1.16022, 37.50620), Coordinate.Create(-44.26398, -131.24380), Coordinate.Create(-33.34325, 154.22495), Coordinate.Create(-59.65879, 90.94370), Coordinate.Create(-62.38215, 0.94370), Coordinate.Create(72.32117, 40.31870), Coordinate.Create(64.66910, 2.34995), Coordinate.Create(-61.04971, -84.83755), Coordinate.Create(77.10238, -91.86880), Coordinate.Create(-72.88859, -129.83755), Coordinate.Create(-69.24987, -24.36880), Coordinate.Create(77.41254, 119.06870), Coordinate.Create(-70.69409, 83.91245), Coordinate.Create(78.85650, 75.47495), Coordinate.Create(26.83989, 140.16245), Coordinate.Create(-24.75069, -108.74380), Coordinate.Create(30.53968, -145.30630), Coordinate.Create(79.12503, 145.78745), Coordinate.Create(-34.51006, 133.13120), Coordinate.Create(-73.29753, -60.93130), Coordinate.Create(-74.08712, 23.44370), Coordinate.Create(-76.57404, 100.78745), Coordinate.Create(-76.57404, 100.78745), Coordinate.Create(39.72082, 103.59995), Coordinate.Create(70.99412, 148.59995), Coordinate.Create(82.27591, 138.75620), Coordinate.Create(78.29964, -3.27505), Coordinate.Create(78.29964, -3.27505), Coordinate.Create(-8.65039, 47.34995)];
35+
36+
37+
[Benchmark]
38+
public Polyline Encode()
39+
=> Encoder
40+
.Encode(Coordinates);
41+
}

benchmarks/PolylineAlgorithm.Benchmarks/PolylineDecoderBenchmark.cs

Lines changed: 0 additions & 37 deletions
This file was deleted.

benchmarks/PolylineAlgorithm.Benchmarks/PolylineEncoderBenchmark.cs

Lines changed: 0 additions & 37 deletions
This file was deleted.

benchmarks/PolylineAlgorithm.Benchmarks/Program.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ namespace PolylineAlgorithm.Benchmarks;
1010
internal class Program {
1111
static void Main(string[] _) {
1212
BenchmarkRunner
13-
.Run<PolylineEncoderBenchmark>();
14-
BenchmarkRunner
15-
.Run<PolylineDecoderBenchmark>();
13+
.Run<PolylineBenchmark>();
1614
}
1715
}

benchmarks/PolylineAlgorithm.Implementation.Benchmarks/PolylineAlgorithm.Implementation.Benchmarks.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net9.0</TargetFramework>
5+
<TargetFrameworks>net9.0</TargetFrameworks>
66
<LangVersion>13.0</LangVersion>
77
<Nullable>enable</Nullable>
88
<ImplicitUsings>enable</ImplicitUsings>
99
<InvariantGlobalization>true</InvariantGlobalization>
1010
<NeutralLanguage>en</NeutralLanguage>
11+
<DebugType>pdbonly</DebugType>
12+
<DebugSymbols>true</DebugSymbols>
1113
</PropertyGroup>
1214

1315
<PropertyGroup>
@@ -16,6 +18,7 @@
1618

1719
<ItemGroup>
1820
<PackageReference Include="BenchmarkDotNet" Version="0.*" />
21+
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.14.0" />
1922
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="9.*" />
2023
</ItemGroup>
2124

0 commit comments

Comments
 (0)