Skip to content

Commit b1606f5

Browse files
author
Petr Sramek
committed
refactoring, xml comments updated, code clean up
1 parent 36b1c51 commit b1606f5

File tree

44 files changed

+1889
-1871
lines changed

Some content is hidden

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

44 files changed

+1889
-1871
lines changed

.editorconfig

Lines changed: 104 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,104 @@
1-
file_header_template = //\n// Copyright (c) Petr Šrámek. All rights reserved.\n// Licensed under the MIT License. See LICENSE file in the project root for full license information.\n//
1+
file_header_template = //\n// Copyright (c) Pete Sramek. All rights reserved.\n// Licensed under the MIT License. See LICENSE file in the project root for full license information.\n//
2+
[*.cs]
3+
#### Naming styles ####
4+
5+
# Naming rules
6+
7+
dotnet_naming_rule.private_or_internal_field_should_be_underscore_camel_case.severity = suggestion
8+
dotnet_naming_rule.private_or_internal_field_should_be_underscore_camel_case.symbols = private_or_internal_field
9+
dotnet_naming_rule.private_or_internal_field_should_be_underscore_camel_case.style = underscore_camel_case
10+
11+
# Symbol specifications
12+
13+
dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
14+
dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected
15+
dotnet_naming_symbols.private_or_internal_field.required_modifiers =
16+
17+
# Naming styles
18+
19+
dotnet_naming_style.underscore_camel_case.required_prefix = _
20+
dotnet_naming_style.underscore_camel_case.required_suffix =
21+
dotnet_naming_style.underscore_camel_case.word_separator =
22+
dotnet_naming_style.underscore_camel_case.capitalization = camel_case
23+
csharp_indent_labels = one_less_than_current
24+
csharp_using_directive_placement = inside_namespace:silent
25+
csharp_prefer_simple_using_statement = false:suggestion
26+
csharp_prefer_braces = true:silent
27+
csharp_style_namespace_declarations = file_scoped:silent
28+
csharp_style_prefer_method_group_conversion = false:silent
29+
csharp_style_prefer_top_level_statements = false:silent
30+
csharp_style_prefer_primary_constructors = true:suggestion
31+
csharp_prefer_system_threading_lock = true:suggestion
32+
csharp_style_expression_bodied_methods = false:silent
33+
csharp_style_expression_bodied_constructors = false:silent
34+
csharp_style_expression_bodied_operators = false:silent
35+
csharp_style_expression_bodied_properties = true:silent
36+
csharp_style_expression_bodied_indexers = true:silent
37+
csharp_style_expression_bodied_accessors = true:silent
38+
csharp_style_expression_bodied_lambdas = when_on_single_line:silent
39+
csharp_style_expression_bodied_local_functions = when_on_single_line:silent
40+
41+
[*.{cs,vb}]
42+
#### Naming styles ####
43+
44+
# Naming rules
45+
46+
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
47+
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
48+
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
49+
50+
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
51+
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
52+
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
53+
54+
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
55+
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
56+
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
57+
58+
# Symbol specifications
59+
60+
dotnet_naming_symbols.interface.applicable_kinds = interface
61+
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
62+
dotnet_naming_symbols.interface.required_modifiers =
63+
64+
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
65+
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
66+
dotnet_naming_symbols.types.required_modifiers =
67+
68+
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
69+
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
70+
dotnet_naming_symbols.non_field_members.required_modifiers =
71+
72+
# Naming styles
73+
74+
dotnet_naming_style.begins_with_i.required_prefix = I
75+
dotnet_naming_style.begins_with_i.required_suffix =
76+
dotnet_naming_style.begins_with_i.word_separator =
77+
dotnet_naming_style.begins_with_i.capitalization = pascal_case
78+
79+
dotnet_naming_style.pascal_case.required_prefix =
80+
dotnet_naming_style.pascal_case.required_suffix =
81+
dotnet_naming_style.pascal_case.word_separator =
82+
dotnet_naming_style.pascal_case.capitalization = pascal_case
83+
84+
dotnet_naming_style.pascal_case.required_prefix =
85+
dotnet_naming_style.pascal_case.required_suffix =
86+
dotnet_naming_style.pascal_case.word_separator =
87+
dotnet_naming_style.pascal_case.capitalization = pascal_case
88+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
89+
tab_width = 4
90+
indent_size = 4
91+
end_of_line = crlf
92+
dotnet_style_coalesce_expression = true:suggestion
93+
dotnet_style_null_propagation = true:suggestion
94+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
95+
dotnet_style_prefer_auto_properties = true:silent
96+
dotnet_style_object_initializer = true:suggestion
97+
dotnet_style_collection_initializer = true:suggestion
98+
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
99+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
100+
dotnet_style_prefer_conditional_expression_over_return = true:silent
101+
dotnet_style_explicit_tuple_names = true:suggestion
102+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
103+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
104+
dotnet_style_prefer_compound_assignment = true:suggestion

PolylineAlgorithm.sln

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PolylineAlgorithm.Benchmark
2323
EndProject
2424
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PolylineAlgorithm.Implementation.Benchmarks", "benchmarks\PolylineAlgorithm.Implementation.Benchmarks\PolylineAlgorithm.Implementation.Benchmarks.csproj", "{D9F175EA-6F4C-4BFF-AB1D-5F45324B6C1B}"
2525
EndProject
26-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PolylineAlgorithm.DependencyInjection", "src\PolylineAlgorithm.DependencyInjection\PolylineAlgorithm.DependencyInjection.csproj", "{0F07B56B-6D9A-4410-BCAB-C6A460C1E44E}"
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}"
2727
EndProject
28-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PolylineAlgorithm.DependencyInjection.Tests", "tests\PolylineAlgorithm.DependencyInjection.Tests\PolylineAlgorithm.DependencyInjection.Tests.csproj", "{9DC1BAD9-60DD-414D-BE88-E181D887A267}"
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}"
2933
EndProject
3034
Global
3135
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -49,14 +53,22 @@ Global
4953
{D9F175EA-6F4C-4BFF-AB1D-5F45324B6C1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
5054
{D9F175EA-6F4C-4BFF-AB1D-5F45324B6C1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
5155
{D9F175EA-6F4C-4BFF-AB1D-5F45324B6C1B}.Release|Any CPU.Build.0 = Release|Any CPU
52-
{0F07B56B-6D9A-4410-BCAB-C6A460C1E44E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
53-
{0F07B56B-6D9A-4410-BCAB-C6A460C1E44E}.Debug|Any CPU.Build.0 = Debug|Any CPU
54-
{0F07B56B-6D9A-4410-BCAB-C6A460C1E44E}.Release|Any CPU.ActiveCfg = Release|Any CPU
55-
{0F07B56B-6D9A-4410-BCAB-C6A460C1E44E}.Release|Any CPU.Build.0 = Release|Any CPU
56-
{9DC1BAD9-60DD-414D-BE88-E181D887A267}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
57-
{9DC1BAD9-60DD-414D-BE88-E181D887A267}.Debug|Any CPU.Build.0 = Debug|Any CPU
58-
{9DC1BAD9-60DD-414D-BE88-E181D887A267}.Release|Any CPU.ActiveCfg = Release|Any CPU
59-
{9DC1BAD9-60DD-414D-BE88-E181D887A267}.Release|Any CPU.Build.0 = Release|Any CPU
56+
{B4FD710A-E5B8-4467-8D0B-037A28132047}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
57+
{B4FD710A-E5B8-4467-8D0B-037A28132047}.Debug|Any CPU.Build.0 = Debug|Any CPU
58+
{B4FD710A-E5B8-4467-8D0B-037A28132047}.Release|Any CPU.ActiveCfg = Release|Any CPU
59+
{B4FD710A-E5B8-4467-8D0B-037A28132047}.Release|Any CPU.Build.0 = Release|Any CPU
60+
{F9CFF4B1-C9AB-4F94-ADF4-B29925E1187E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
61+
{F9CFF4B1-C9AB-4F94-ADF4-B29925E1187E}.Debug|Any CPU.Build.0 = Debug|Any CPU
62+
{F9CFF4B1-C9AB-4F94-ADF4-B29925E1187E}.Release|Any CPU.ActiveCfg = Release|Any CPU
63+
{F9CFF4B1-C9AB-4F94-ADF4-B29925E1187E}.Release|Any CPU.Build.0 = Release|Any CPU
64+
{9C1088DA-DBF7-4374-9775-C7613CCA98D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
65+
{9C1088DA-DBF7-4374-9775-C7613CCA98D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
66+
{9C1088DA-DBF7-4374-9775-C7613CCA98D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
67+
{9C1088DA-DBF7-4374-9775-C7613CCA98D8}.Release|Any CPU.Build.0 = Release|Any CPU
68+
{2B0061B3-7B80-4101-9FF0-AD513AE4C4E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
69+
{2B0061B3-7B80-4101-9FF0-AD513AE4C4E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
70+
{2B0061B3-7B80-4101-9FF0-AD513AE4C4E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
71+
{2B0061B3-7B80-4101-9FF0-AD513AE4C4E5}.Release|Any CPU.Build.0 = Release|Any CPU
6072
EndGlobalSection
6173
GlobalSection(SolutionProperties) = preSolution
6274
HideSolutionNode = FALSE
@@ -66,8 +78,10 @@ Global
6678
{30324A08-AA42-425D-87DA-8F9C6AF60454} = {576FEFFC-B624-40C3-A8AF-4E5233802EA0}
6779
{9C7CBAD5-415B-4589-86E1-01C849F9C56C} = {33C03F16-4313-4579-87E6-65892AF21D7D}
6880
{D9F175EA-6F4C-4BFF-AB1D-5F45324B6C1B} = {33C03F16-4313-4579-87E6-65892AF21D7D}
69-
{0F07B56B-6D9A-4410-BCAB-C6A460C1E44E} = {51C886AF-D610-48A4-9D73-2DEB38742801}
70-
{9DC1BAD9-60DD-414D-BE88-E181D887A267} = {576FEFFC-B624-40C3-A8AF-4E5233802EA0}
81+
{B4FD710A-E5B8-4467-8D0B-037A28132047} = {576FEFFC-B624-40C3-A8AF-4E5233802EA0}
82+
{F9CFF4B1-C9AB-4F94-ADF4-B29925E1187E} = {576FEFFC-B624-40C3-A8AF-4E5233802EA0}
83+
{9C1088DA-DBF7-4374-9775-C7613CCA98D8} = {51C886AF-D610-48A4-9D73-2DEB38742801}
84+
{2B0061B3-7B80-4101-9FF0-AD513AE4C4E5} = {51C886AF-D610-48A4-9D73-2DEB38742801}
7185
EndGlobalSection
7286
GlobalSection(ExtensibilityGlobals) = postSolution
7387
SolutionGuid = {93A268DC-0947-4FBB-B495-DDAD4B013D82}
Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
//
2-
// Copyright (c) Petr Šrámek. All rights reserved.
2+
// Copyright (c) Pete Sramek. All rights reserved.
33
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
44
//
55

6-
namespace PolylineAlgorithm.Benchmarks {
7-
using BenchmarkDotNet.Attributes;
8-
using BenchmarkDotNet.Engines;
9-
using BenchmarkDotNet.Order;
6+
namespace PolylineAlgorithm.Benchmarks;
107

11-
[MemoryDiagnoser]
12-
[MarkdownExporter]
13-
[Orderer(SummaryOrderPolicy.FastestToSlowest)]
14-
public class PolylineDecoderBenchmark {
15-
private readonly Consumer _consumer = new();
8+
using BenchmarkDotNet.Attributes;
9+
using BenchmarkDotNet.Engines;
10+
using BenchmarkDotNet.Order;
1611

17-
public IPolylineDecoder Decoder { get; set; }
12+
[MemoryDiagnoser]
13+
[MarkdownExporter]
14+
[Orderer(SummaryOrderPolicy.FastestToSlowest)]
15+
public class PolylineDecoderBenchmark {
16+
private readonly Consumer _consumer = new();
1817

19-
public static IEnumerable<string> GetPolylines() {
20-
yield return "mz}lHssngJj`gqSnx~lEcovfTnms{Zdy~qQj_deI";
21-
yield return "}vwdGjafcRsvjKi}pxUhsrtCngtcAjjgzEdqvtLrscbKj}nr@wetlUc`nq]}_kfCyrfaK~wluUl`u}|@wa{lUmmuap@va{lU~oihCu||bF`|era@wsnnIjny{DxamaScqxza@dklDf{}kb@mtpeCavfzGqhx`Wyzzkm@jm`d@dba~Pppkg@h}pxU|rtnHp|flA|~xaPuykyN}fhv[h}pxUx~p}Ymx`sZih~iB{edwB";
22-
yield return "}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";
23-
}
18+
public required IPolylineDecoder Decoder { get; set; }
2419

25-
[GlobalSetup]
26-
public void Setup() {
27-
Decoder = new PolylineDecoder(new CoordinateValidator());
28-
}
20+
public static IEnumerable<string> GetPolylines() {
21+
yield return "mz}lHssngJj`gqSnx~lEcovfTnms{Zdy~qQj_deI";
22+
yield return "}vwdGjafcRsvjKi}pxUhsrtCngtcAjjgzEdqvtLrscbKj}nr@wetlUc`nq]}_kfCyrfaK~wluUl`u}|@wa{lUmmuap@va{lU~oihCu||bF`|era@wsnnIjny{DxamaScqxza@dklDf{}kb@mtpeCavfzGqhx`Wyzzkm@jm`d@dba~Pppkg@h}pxU|rtnHp|flA|~xaPuykyN}fhv[h}pxUx~p}Ymx`sZih~iB{edwB";
23+
yield return "}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";
24+
}
2925

30-
[Benchmark]
31-
[ArgumentsSource(nameof(GetPolylines))]
32-
public void Decode(string polyline) => Decoder
33-
.Decode(polyline)
34-
.Consume(_consumer);
26+
[GlobalSetup]
27+
public void Setup() {
28+
Decoder = new PolylineDecoder(new CoordinateValidator());
3529
}
30+
31+
[Benchmark]
32+
[ArgumentsSource(nameof(GetPolylines))]
33+
public void Decode(string polyline) => Decoder
34+
.Decode(polyline)
35+
.Consume(_consumer);
3636
}
Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
//
2-
// Copyright (c) Petr Šrámek. All rights reserved.
2+
// Copyright (c) Pete Sramek. All rights reserved.
33
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
44
//
55

6-
namespace PolylineAlgorithm.Benchmarks {
7-
using BenchmarkDotNet.Attributes;
8-
using BenchmarkDotNet.Engines;
9-
using BenchmarkDotNet.Order;
6+
namespace PolylineAlgorithm.Benchmarks;
107

11-
[MemoryDiagnoser]
12-
[MarkdownExporter]
13-
[Orderer(SummaryOrderPolicy.FastestToSlowest)]
14-
public class PolylineEncoderBenchmark {
15-
private readonly Consumer _consumer = new();
8+
using BenchmarkDotNet.Attributes;
9+
using BenchmarkDotNet.Engines;
10+
using BenchmarkDotNet.Order;
1611

17-
public IPolylineEncoder Encoder { get; set; }
12+
[MemoryDiagnoser]
13+
[MarkdownExporter]
14+
[Orderer(SummaryOrderPolicy.FastestToSlowest)]
15+
public class PolylineEncoderBenchmark {
16+
private readonly Consumer _consumer = new();
1817

19-
public IEnumerable<IEnumerable<(double, double)>> GetCoordinates() {
20-
yield return new[] { (49.47383, 59.06250), (-58.37407, 25.31250), (52.99363, -120.93750), (-44.49024, -174.37500) };
21-
yield return new[] { (42.88895, -100.30630), (44.91513, 19.22495), (20.40244, 7.97495), (-15.52130, -63.74380), (-78.95116, -72.18130), (38.63072, 88.13120), (60.81071, 151.41245), (-58.20769, -173.43130), (59.40939, 83.91245), (-58.20769, 61.41245), (-20.86278, -119.99380), (34.10374, -150.93130), (-71.15367, 31.88120), (-72.04138, -153.74380), (-49.99635, -107.33755), (76.12614, 135.94370), (70.05664, 41.72495), (63.43879, -77.80630), (13.68456, -90.46255), (-75.90519, -7.49380), (74.71112, -127.02505), (-66.61109, 17.81870), (-49.08384, 37.50620) };
22-
yield return new[] { (60.81071, -121.40005), (70.05664, -38.43130), (37.52379, -84.83755), (41.85003, 26.25620), (68.04709, 110.63120), (61.48922, 50.16245), (-4.46018, -58.11880), (-32.16061, -3.27505), (-50.89185, -55.30630), (-28.52070, 90.94370), (35.26009, 93.75620), (54.83622, 128.91245), (1.16022, 37.50620), (-44.26398, -131.24380), (-33.34325, 154.22495), (-59.65879, 90.94370), (-62.38215, 0.94370), (72.32117, 40.31870), (64.66910, 2.34995), (-61.04971, -84.83755), (77.10238, -91.86880), (-72.88859, -129.83755), (-69.24987, -24.36880), (77.41254, 119.06870), (-70.69409, 83.91245), (78.85650, 75.47495), (26.83989, 140.16245), (-24.75069, -108.74380), (30.53968, -145.30630), (79.12503, 145.78745), (-34.51006, 133.13120), (-73.29753, -60.93130), (-74.08712, 23.44370), (-76.57404, 100.78745), (-76.57404, 100.78745), (39.72082, 103.59995), (70.99412, 148.59995), (82.27591, 138.75620), (78.29964, -3.27505), (78.29964, -3.27505), (-8.65039, 47.34995) };
23-
}
18+
public required IPolylineEncoder Encoder { get; set; }
2419

25-
[GlobalSetup]
26-
public void Setup() {
27-
Encoder = new PolylineEncoder(new CoordinateValidator());
28-
}
20+
public static IEnumerable<IEnumerable<(double, double)>> GetCoordinates() {
21+
yield return new[] { (49.47383, 59.06250), (-58.37407, 25.31250), (52.99363, -120.93750), (-44.49024, -174.37500) };
22+
yield return new[] { (42.88895, -100.30630), (44.91513, 19.22495), (20.40244, 7.97495), (-15.52130, -63.74380), (-78.95116, -72.18130), (38.63072, 88.13120), (60.81071, 151.41245), (-58.20769, -173.43130), (59.40939, 83.91245), (-58.20769, 61.41245), (-20.86278, -119.99380), (34.10374, -150.93130), (-71.15367, 31.88120), (-72.04138, -153.74380), (-49.99635, -107.33755), (76.12614, 135.94370), (70.05664, 41.72495), (63.43879, -77.80630), (13.68456, -90.46255), (-75.90519, -7.49380), (74.71112, -127.02505), (-66.61109, 17.81870), (-49.08384, 37.50620) };
23+
yield return new[] { (60.81071, -121.40005), (70.05664, -38.43130), (37.52379, -84.83755), (41.85003, 26.25620), (68.04709, 110.63120), (61.48922, 50.16245), (-4.46018, -58.11880), (-32.16061, -3.27505), (-50.89185, -55.30630), (-28.52070, 90.94370), (35.26009, 93.75620), (54.83622, 128.91245), (1.16022, 37.50620), (-44.26398, -131.24380), (-33.34325, 154.22495), (-59.65879, 90.94370), (-62.38215, 0.94370), (72.32117, 40.31870), (64.66910, 2.34995), (-61.04971, -84.83755), (77.10238, -91.86880), (-72.88859, -129.83755), (-69.24987, -24.36880), (77.41254, 119.06870), (-70.69409, 83.91245), (78.85650, 75.47495), (26.83989, 140.16245), (-24.75069, -108.74380), (30.53968, -145.30630), (79.12503, 145.78745), (-34.51006, 133.13120), (-73.29753, -60.93130), (-74.08712, 23.44370), (-76.57404, 100.78745), (-76.57404, 100.78745), (39.72082, 103.59995), (70.99412, 148.59995), (82.27591, 138.75620), (78.29964, -3.27505), (78.29964, -3.27505), (-8.65039, 47.34995) };
24+
}
2925

30-
[Benchmark]
31-
[ArgumentsSource(nameof(GetCoordinates))]
32-
public void Encode(IEnumerable<(double, double)> coordinates) => Encoder
33-
.Encode(coordinates)
34-
.Consume(_consumer);
26+
[GlobalSetup]
27+
public void Setup() {
28+
Encoder = new PolylineEncoder(new CoordinateValidator());
3529
}
30+
31+
[Benchmark]
32+
[ArgumentsSource(nameof(GetCoordinates))]
33+
public void Encode(IEnumerable<(double, double)> coordinates) => Encoder
34+
.Encode(coordinates)
35+
.Consume(_consumer);
3636
}
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
//
2-
// Copyright (c) Petr Šrámek. All rights reserved.
2+
// Copyright (c) Pete Sramek. All rights reserved.
33
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
44
//
55

6-
namespace PolylineAlgorithm.Benchmarks {
7-
using BenchmarkDotNet.Running;
6+
namespace PolylineAlgorithm.Benchmarks;
87

9-
internal class Program {
10-
static void Main(string[] _) {
11-
BenchmarkRunner
12-
.Run<PolylineEncoderBenchmark>();
13-
BenchmarkRunner
14-
.Run<PolylineDecoderBenchmark>();
15-
}
8+
using BenchmarkDotNet.Running;
9+
10+
internal class Program {
11+
static void Main(string[] _) {
12+
BenchmarkRunner
13+
.Run<PolylineEncoderBenchmark>();
14+
BenchmarkRunner
15+
.Run<PolylineDecoderBenchmark>();
1616
}
1717
}

benchmarks/PolylineAlgorithm.Implementation.Benchmarks/Constants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright (c) Petr Šrámek. All rights reserved.
2+
// Copyright (c) Pete Sramek. All rights reserved.
33
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
44
//
55

0 commit comments

Comments
 (0)