You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Benchmarks for the <see cref="Polyline"/> struct.
15
+
/// Benchmarks for the <see cref="PolylineValue"/> struct.
16
16
/// </summary>
17
17
[RankColumn]
18
18
publicclassPolylineBenchmark{
@@ -23,24 +23,24 @@ public class PolylineBenchmark {
23
23
24
24
#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.
25
25
/// <summary>
26
-
/// Gets the string value representing the encoded polyline.
26
+
/// Gets the character array representing the encoded polyline.
27
27
/// </summary>
28
-
publicstringStringValue{get;privateset;}
28
+
publicchar[]CharArrayValue{get;privateset;}
29
29
30
30
/// <summary>
31
-
/// Gets the character array representing the encoded polyline.
31
+
/// Gets the read-only memory representing the encoded polyline.
/// Gets the read-only memory representing the encoded polyline.
37
37
/// </summary>
38
-
publicReadOnlyMemory<char>Memory{get;privateset;}
38
+
publicPolylinePolylineValue{get;privateset;}
39
39
40
40
/// <summary>
41
-
/// Gets the read-only memory representing the encoded polyline.
41
+
/// Gets the string value representing the encoded polyline.
42
42
/// </summary>
43
-
publicPolylinePolyline{get;privateset;}
43
+
publicstringStringValue{get;privateset;}
44
44
45
45
#pragma warning restore CS8618// Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.
46
46
@@ -50,10 +50,10 @@ public class PolylineBenchmark {
50
50
/// </summary>
51
51
[GlobalSetup]
52
52
publicvoidSetupData(){
53
-
Polyline=ValueProvider.GetPolyline(Length);
54
-
StringValue=Polyline.ToString();
55
-
CharArray=StringValue.ToArray();
56
-
Memory=CharArray.AsMemory();
53
+
PolylineValue=ValueProvider.GetPolyline(Length);
54
+
StringValue=PolylineValue.ToString();
55
+
CharArrayValue=StringValue.ToArray();
56
+
MemoryValue=CharArrayValue.AsMemory();
57
57
}
58
58
59
59
/// <summary>
@@ -75,7 +75,7 @@ public Polyline Polyline_FromString() {
75
75
[Benchmark]
76
76
publicPolylinePolyline_FromCharArray(){
77
77
varpolyline=Polyline
78
-
.FromCharArray(CharArray);
78
+
.FromCharArray(CharArrayValue);
79
79
80
80
returnpolyline;
81
81
}
@@ -87,7 +87,7 @@ public Polyline Polyline_FromCharArray() {
87
87
[Benchmark]
88
88
publicPolylinePolyline_FromMemory(){
89
89
varpolyline=Polyline
90
-
.FromMemory(Memory);
90
+
.FromMemory(MemoryValue);
91
91
92
92
returnpolyline;
93
93
}
@@ -98,23 +98,23 @@ public Polyline Polyline_FromMemory() {
98
98
/// <returns>The encoded polyline.</returns>
99
99
[Benchmark]
100
100
publicstringPolyline_ToString(){
101
-
varstringValue=Polyline
101
+
varstringValue=PolylineValue
102
102
.ToString();
103
103
104
104
returnstringValue;
105
105
}
106
106
107
-
/// <summary>
108
-
/// Benchmarks the encoding of an enumeration of coordinates into a polyline.
109
-
/// </summary>
110
-
/// <returns>The encoded polyline.</returns>
111
-
[Benchmark]
112
-
publiclongPolyline_GetCoordinateCount(){
113
-
varcoordinateCount=Polyline
114
-
.GetCoordinateCount();
107
+
///// <summary>
108
+
///// Benchmarks the encoding of an enumeration of coordinates into a polyline.
109
+
///// </summary>
110
+
///// <returns>The encoded polyline.</returns>
111
+
//[Benchmark]
112
+
//public long Polyline_GetCoordinateCount() {
113
+
// var coordinateCount = PolylineValue
114
+
// .GetCoordinateCount();
115
115
116
-
returncoordinateCount;
117
-
}
116
+
// return coordinateCount;
117
+
//}
118
118
119
119
120
120
/// <summary>
@@ -123,9 +123,9 @@ public long Polyline_GetCoordinateCount() {
123
123
/// <returns>The encoded polyline.</returns>
124
124
[Benchmark]
125
125
publicvoidPolyline_CopyTo(){
126
-
vardestination=newchar[Polyline.Length];
126
+
vardestination=newchar[PolylineValue.Length];
127
127
128
-
Polyline
128
+
PolylineValue
129
129
.CopyTo(destination);
130
130
131
131
destination
@@ -138,8 +138,8 @@ public void Polyline_CopyTo() {
#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.
0 commit comments