Skip to content

Commit 7c0823c

Browse files
author
Petr Sramek
committed
improvements, cleanup, etc
1 parent 741f467 commit 7c0823c

File tree

42 files changed

+402
-2379
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+402
-2379
lines changed

PolylineAlgorithm.sln

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks",
2121
EndProject
2222
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PolylineAlgorithm.Benchmarks", "benchmarks\PolylineAlgorithm.Benchmarks\PolylineAlgorithm.Benchmarks.csproj", "{9C7CBAD5-415B-4589-86E1-01C849F9C56C}"
2323
EndProject
24-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PolylineAlgorithm.Implementation.Benchmarks", "benchmarks\PolylineAlgorithm.Implementation.Benchmarks\PolylineAlgorithm.Implementation.Benchmarks.csproj", "{D9F175EA-6F4C-4BFF-AB1D-5F45324B6C1B}"
25-
EndProject
26-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PolylineAlgorithm.DependencyInjection.Microsoft.Tests", "tests\PolylineAlgorithm.DependencyInjection.Microsoft.Tests\PolylineAlgorithm.DependencyInjection.Microsoft.Tests.csproj", "{B4FD710A-E5B8-4467-8D0B-037A28132047}"
27-
EndProject
28-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PolylineAlgorithm.DependencyInjection.Autofac.Tests", "tests\PolylineAlgorithm.DependencyInjection.Autofac.Tests\PolylineAlgorithm.DependencyInjection.Autofac.Tests.csproj", "{F9CFF4B1-C9AB-4F94-ADF4-B29925E1187E}"
29-
EndProject
30-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PolylineAlgorithm.DependencyInjection.Autofac", "src\PolylineAlgorithm.DependencyInjection.Autofac\PolylineAlgorithm.DependencyInjection.Autofac.csproj", "{9C1088DA-DBF7-4374-9775-C7613CCA98D8}"
31-
EndProject
32-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PolylineAlgorithm.DependencyInjection.Microsoft", "src\PolylineAlgorithm.DependencyInjection.Microsoft\PolylineAlgorithm.DependencyInjection.Microsoft.csproj", "{2B0061B3-7B80-4101-9FF0-AD513AE4C4E5}"
33-
EndProject
34-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PolylineAlgorithm.NetTopologySuite", "src\PolylineAlgorithm.NetTopologySuite\PolylineAlgorithm.NetTopologySuite.csproj", "{A5F4D456-3949-4146-95D2-E0208EEF207A}"
35-
EndProject
3624
Global
3725
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3826
Debug|Any CPU = Debug|Any CPU
@@ -51,30 +39,6 @@ Global
5139
{9C7CBAD5-415B-4589-86E1-01C849F9C56C}.Debug|Any CPU.Build.0 = Debug|Any CPU
5240
{9C7CBAD5-415B-4589-86E1-01C849F9C56C}.Release|Any CPU.ActiveCfg = Release|Any CPU
5341
{9C7CBAD5-415B-4589-86E1-01C849F9C56C}.Release|Any CPU.Build.0 = Release|Any CPU
54-
{D9F175EA-6F4C-4BFF-AB1D-5F45324B6C1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
55-
{D9F175EA-6F4C-4BFF-AB1D-5F45324B6C1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
56-
{D9F175EA-6F4C-4BFF-AB1D-5F45324B6C1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
57-
{D9F175EA-6F4C-4BFF-AB1D-5F45324B6C1B}.Release|Any CPU.Build.0 = Release|Any CPU
58-
{B4FD710A-E5B8-4467-8D0B-037A28132047}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
59-
{B4FD710A-E5B8-4467-8D0B-037A28132047}.Debug|Any CPU.Build.0 = Debug|Any CPU
60-
{B4FD710A-E5B8-4467-8D0B-037A28132047}.Release|Any CPU.ActiveCfg = Release|Any CPU
61-
{B4FD710A-E5B8-4467-8D0B-037A28132047}.Release|Any CPU.Build.0 = Release|Any CPU
62-
{F9CFF4B1-C9AB-4F94-ADF4-B29925E1187E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
63-
{F9CFF4B1-C9AB-4F94-ADF4-B29925E1187E}.Debug|Any CPU.Build.0 = Debug|Any CPU
64-
{F9CFF4B1-C9AB-4F94-ADF4-B29925E1187E}.Release|Any CPU.ActiveCfg = Release|Any CPU
65-
{F9CFF4B1-C9AB-4F94-ADF4-B29925E1187E}.Release|Any CPU.Build.0 = Release|Any CPU
66-
{9C1088DA-DBF7-4374-9775-C7613CCA98D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
67-
{9C1088DA-DBF7-4374-9775-C7613CCA98D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
68-
{9C1088DA-DBF7-4374-9775-C7613CCA98D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
69-
{9C1088DA-DBF7-4374-9775-C7613CCA98D8}.Release|Any CPU.Build.0 = Release|Any CPU
70-
{2B0061B3-7B80-4101-9FF0-AD513AE4C4E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
71-
{2B0061B3-7B80-4101-9FF0-AD513AE4C4E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
72-
{2B0061B3-7B80-4101-9FF0-AD513AE4C4E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
73-
{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
7842
EndGlobalSection
7943
GlobalSection(SolutionProperties) = preSolution
8044
HideSolutionNode = FALSE
@@ -83,12 +47,6 @@ Global
8347
{882322A6-E758-4662-8D1C-7C555C8FC3F2} = {51C886AF-D610-48A4-9D73-2DEB38742801}
8448
{30324A08-AA42-425D-87DA-8F9C6AF60454} = {576FEFFC-B624-40C3-A8AF-4E5233802EA0}
8549
{9C7CBAD5-415B-4589-86E1-01C849F9C56C} = {33C03F16-4313-4579-87E6-65892AF21D7D}
86-
{D9F175EA-6F4C-4BFF-AB1D-5F45324B6C1B} = {33C03F16-4313-4579-87E6-65892AF21D7D}
87-
{B4FD710A-E5B8-4467-8D0B-037A28132047} = {576FEFFC-B624-40C3-A8AF-4E5233802EA0}
88-
{F9CFF4B1-C9AB-4F94-ADF4-B29925E1187E} = {576FEFFC-B624-40C3-A8AF-4E5233802EA0}
89-
{9C1088DA-DBF7-4374-9775-C7613CCA98D8} = {51C886AF-D610-48A4-9D73-2DEB38742801}
90-
{2B0061B3-7B80-4101-9FF0-AD513AE4C4E5} = {51C886AF-D610-48A4-9D73-2DEB38742801}
91-
{A5F4D456-3949-4146-95D2-E0208EEF207A} = {51C886AF-D610-48A4-9D73-2DEB38742801}
9250
EndGlobalSection
9351
GlobalSection(ExtensibilityGlobals) = postSolution
9452
SolutionGuid = {93A268DC-0947-4FBB-B495-DDAD4B013D82}

benchmarks/PolylineAlgorithm.Benchmarks/PolylineAlgorithm.Benchmarks.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
<ItemGroup>
1818
<PackageReference Include="BenchmarkDotNet" Version="0.*" />
19+
<PackageReference Include="Cloudikka.PolylineAlgorithm" Version="1.*" />
20+
<PackageReference Include="PolylineEncoder.Net" Version="1.*" />
21+
<PackageReference Include="Polyliner.Net" Version="1.*" />
1922
</ItemGroup>
2023

2124
<ItemGroup>

benchmarks/PolylineAlgorithm.Benchmarks/PolylineBenchmark.cs

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ namespace PolylineAlgorithm.Benchmarks;
88
using BenchmarkDotNet.Attributes;
99
using BenchmarkDotNet.Engines;
1010
using BenchmarkDotNet.Jobs;
11+
using BenchmarkDotNet.Order;
12+
using Cloudikka.PolylineAlgorithm.Encoding;
13+
using PolylineAlgorithm;
14+
using PolylinerNet;
1115
using System.Collections.Generic;
1216

1317
[RankColumn]
@@ -17,25 +21,55 @@ namespace PolylineAlgorithm.Benchmarks;
1721
[SimpleJob(RuntimeMoniker.Net70)]
1822
[SimpleJob(RuntimeMoniker.Net80)]
1923
[SimpleJob(RuntimeMoniker.Net90)]
20-
[Orderer(BenchmarkDotNet.Order.SummaryOrderPolicy.Declared)]
24+
[Orderer(SummaryOrderPolicy.Default)]
2125
public class PolylineBenchmark {
2226
private readonly Consumer _consumer = new();
27+
public static string String_Polyline { get; } = "}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";
28+
public static ReadOnlyMemory<char> Memory_Polyline { get; } = String_Polyline.AsMemory();
2329

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");
30+
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)];
31+
public static List<PolylinePoint> PolylinerNet_PolylinePoint { 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)];
32+
public static IEnumerable<(double, double)> Cloudikka_PolylineEncoding_Tuple { 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)];
33+
34+
35+
36+
[Benchmark]
37+
public void PolylineDecoder_Decode() {
38+
ReadOnlySpan<char> polyline = Memory_Polyline.Span;
39+
var decoder = new PolylineDecoder();
40+
decoder.Decode(in polyline).Consume(_consumer);
41+
}
2642

2743
[Benchmark]
28-
public Span<Coordinate> Decode()
29-
=> Decoder
30-
.Decode(Polyline);
44+
public void Polyliner_Decode() {
45+
string polyline = String_Polyline;
46+
var polyliner = new Polyliner();
47+
polyliner.Decode(polyline).Consume(_consumer);
48+
}
49+
50+
[Benchmark]
51+
public void Cloudikka_PolylineEncoding_Decode() {
52+
string polyline = String_Polyline;
53+
var polyliner = new PolylineEncoding();
54+
polyliner.Decode(polyline).Consume(_consumer);
55+
}
3156

32-
public DefaultPolylineEncoder Encoder { get; } = new DefaultPolylineEncoder();
3357

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)];
58+
[Benchmark]
59+
public ReadOnlySpan<char> PolylineEncoder_Encode() {
60+
var encoder = new PolylineEncoder();
61+
return encoder.Encode(PolylineAlgorithm_Coordinates);
62+
}
3563

64+
[Benchmark]
65+
public string Polyliner_Encode() {
66+
var polyliner = new Polyliner();
67+
return polyliner.Encode(PolylinerNet_PolylinePoint);
68+
}
3669

3770
[Benchmark]
38-
public Polyline Encode()
39-
=> Encoder
40-
.Encode(Coordinates);
71+
public string Cloudikka_PolylineEncoding_Encode() {
72+
var polyliner = new PolylineEncoding();
73+
return polyliner.Encode(Cloudikka_PolylineEncoding_Tuple);
74+
}
4175
}

benchmarks/PolylineAlgorithm.Implementation.Benchmarks/Constants.cs

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

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

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

0 commit comments

Comments
 (0)