Skip to content

Commit 11c3afa

Browse files
committed
Updating some benchmarks
1 parent 18d4aff commit 11c3afa

File tree

5 files changed

+4
-8
lines changed

5 files changed

+4
-8
lines changed

src/Http/Http/src/Features/QueryFeature.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ public IQueryCollection Query
148148
accumulator.Append(
149149
Uri.UnescapeDataString(name.Replace('+', ' ')),
150150
Uri.UnescapeDataString(value.Replace('+', ' ')));
151-
152151
equalIndex = queryString.IndexOf('=', delimiterIndex);
153152
if (equalIndex == -1)
154153
{
@@ -201,7 +200,7 @@ public void Append(string key, string value)
201200
// Marker entry for this key to indicate entry already in expanding list dictionary
202201
_expandingAccumulator[key].Add(value);
203202
}
204-
else if (values.Count < 5)
203+
else if (values.Count == 1)
205204
{
206205
_accumulator[key] = StringValues.Concat(values, value);
207206
}
@@ -212,7 +211,7 @@ public void Append(string key, string value)
212211

213212
if (_expandingAccumulator == null)
214213
{
215-
_expandingAccumulator = new AdaptiveCapacityDictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase);
214+
_expandingAccumulator = new AdaptiveCapacityDictionary<string, List<string>>(5, StringComparer.OrdinalIgnoreCase);
216215
}
217216

218217
// Already 5 entries so use starting allocated as 10; then use List's expansion mechanism for more

src/Http/Routing/samples/MapActionSample/Startup.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
4040

4141
endpoints.MapGet("/", async context =>
4242
{
43-
var res = context.Request.Query["foo"];
44-
await context.Response.WriteAsync(res.ToString());
43+
await context.Response.WriteAsync("Hello World!");
4544
});
4645
});
4746
}

src/Http/WebUtilities/src/Microsoft.AspNetCore.WebUtilities.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
<ItemGroup>
1515
<Compile Include="$(SharedSourceRoot)WebEncoders\**\*.cs" />
1616
<Compile Include="$(SharedSourceRoot)UrlDecoder\**\*.cs" />
17-
<Compile Include="..\..\..\Shared\Dictionary\AdaptiveCapacityDictionary.cs" LinkBase="Internal" />
1817
</ItemGroup>
1918

2019
<ItemGroup>

src/Http/WebUtilities/src/QueryHelpers.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Linq;
77
using System.Text;
88
using System.Text.Encodings.Web;
9-
using Microsoft.AspNetCore.Internal;
109
using Microsoft.Extensions.Primitives;
1110

1211
namespace Microsoft.AspNetCore.WebUtilities

src/Shared/Dictionary/AdaptiveCapacityDictionary.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ private void EnsureCapacitySlow(int capacity)
554554
else
555555
{
556556
// Initial capacity is 5, grows to 10 once.
557-
capacity = _arrayStorage.Length == 0 ? DefaultArrayThreshold / 2 : _arrayStorage.Length * 2;
557+
capacity = _arrayStorage.Length == 0 ? DefaultArrayThreshold : _arrayStorage.Length * 2;
558558
var array = new KeyValuePair<TKey, TValue>[capacity];
559559
if (_count > 0)
560560
{

0 commit comments

Comments
 (0)