Skip to content

Commit 8434464

Browse files
committed
cleanup
1 parent 11cea37 commit 8434464

6 files changed

Lines changed: 12 additions & 21 deletions

File tree

benchmarks/PolylineAlgorithm.Benchmarks/PolylineBenchmark.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace PolylineAlgorithm.Benchmarks;
1717
public class PolylineBenchmark {
1818
private static readonly Consumer consumer = new();
1919

20-
[Params(1, 25, 50, 100, 250, 500, 1_000, 5_000, 10_000, 25_000, 50_000, 100_000, 500_000, 1_000_000)]
20+
[Params(1, 25, 50, 100, 250, 500, 1_000)]
2121
public int Count;
2222

2323
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.

benchmarks/PolylineAlgorithm.Benchmarks/PolylineDecoderBenchmark.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace PolylineAlgorithm.Benchmarks;
1717
public class PolylineDecoderBenchmark {
1818
private readonly Consumer _consumer = new();
1919

20-
[Params(1, 25, 50, 100, 250, 500, 1_000, 5_000, 10_000, 25_000, 50_000, 100_000, 500_000, 1_000_000)]
20+
[Params(1, 25, 50, 100, 250, 500, 1_000)]
2121
public int Count;
2222

2323
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.

benchmarks/PolylineAlgorithm.Benchmarks/PolylineEncoderBenchmark.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace PolylineAlgorithm.Benchmarks;
1515
/// </summary>
1616
[RankColumn]
1717
public class PolylineEncoderBenchmark {
18-
[Params(1, 25, 50, 100, 250, 500, 1_000, 5_000, 10_000, 25_000, 50_000, 100_000, 500_000, 1_000_000)]
18+
[Params(1, 25, 50, 100, 250, 500, 1_000)]
1919
public int Count;
2020

2121
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.
@@ -35,11 +35,6 @@ public class PolylineEncoderBenchmark {
3535
/// </summary>
3636
public PolylineEncoder Encoder = new();
3737

38-
/// <summary>
39-
/// The async polyline encoder instance.
40-
/// </summary>
41-
//public AsyncPolylineEncoder AsyncEncoder = new();
42-
4338
/// <summary>
4439
/// Sets up the data for the benchmarks.
4540
/// </summary>

benchmarks/PolylineAlgorithm.Benchmarks/Program.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55

66
namespace PolylineAlgorithm.Benchmarks;
77

8+
using BenchmarkDotNet.Configs;
9+
using BenchmarkDotNet.Engines;
810
using BenchmarkDotNet.Running;
11+
using Microsoft.CodeAnalysis;
912

1013
/// <summary>
1114
/// The main entry point for the benchmark application.
@@ -16,10 +19,8 @@ internal class Program {
1619
/// </summary>
1720
/// <param name="args">The command-line arguments.</param>
1821
static void Main(string[] args) {
19-
//Directory.Delete("C:\\temp\\benchmark", true);
20-
2122
BenchmarkSwitcher
2223
.FromAssembly(typeof(Program).Assembly)
23-
.Run(args/*, new DebugInProcessConfig()*/);
24+
.Run(args, new DebugInProcessConfig());
2425
}
2526
}

src/PolylineAlgorithm.Abstraction/PolylineEncoder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ public TPolyline Encode(IEnumerable<TCoordinate> coordinates) {
5656
int consumed = 0;
5757
int length = count * Defaults.Polyline.MaxEncodedCoordinateLength;
5858

59-
if (length > Options.MaxCharCount) {
60-
length = Options.MaxCharCount;
59+
if (length > Options.BufferSize / sizeof(char)) {
60+
length = Options.BufferSize / sizeof(char);
6161
}
6262

6363
Span<char> buffer = stackalloc char[length];

src/PolylineAlgorithm.Abstraction/PolylineEncodingOptions.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
namespace PolylineAlgorithm.Abstraction;
77

8+
using PolylineAlgorithm.Abstraction.Validation;
89
using PolylineAlgorithm.Abstraction.Validation.Abstraction;
910

1011
/// <summary>
@@ -15,16 +16,10 @@ public class PolylineEncodingOptions<TCoordinate> {
1516
/// <summary>
1617
/// Gets the maximum buffer size for encoding operations.
1718
/// </summary>
18-
public int BufferSize { get; internal set; }
19-
20-
/// <summary>
21-
/// Gets the maximum number of characters that can be used in the encoding buffer.
22-
/// </summary>
23-
/// <returns>The maximum character count based on the buffer size.</returns>
24-
public int MaxCharCount => BufferSize / sizeof(char);
19+
public int BufferSize { get; internal set; } = 64_000;
2520

2621
/// <summary>
2722
/// Gets the validator used to validate coordinates, latitude, and longitude values.
2823
/// </summary>
29-
public Validator<TCoordinate> Validator { get; internal set; }
24+
public Validator<TCoordinate> Validator { get; internal set; } = new NullValidator<TCoordinate>();
3025
}

0 commit comments

Comments
 (0)