Files
DotNetty/test/DotNetty.Microbench/Http/ClientCookieDecoderBenchmark.cs
Andrey Ilnitsky 1cdaadbfaa - target net472 and netstandard2.0
- microsoft.extensions.logging 5.0.0
- microsoft.extensions.configuration 5.0.0
2021-07-16 18:04:31 -07:00

29 lines
1008 B
C#

// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace DotNetty.Microbench.Http
{
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using DotNetty.Codecs.Http.Cookies;
using DotNetty.Common;
[SimpleJob(RuntimeMoniker.NetCoreApp31)]
[BenchmarkCategory("Http")]
public class ClientCookieDecoderBenchmark
{
const string CookieString =
"__Host-user_session_same_site=fgfMsM59vJTpZg88nxqKkIhgOt0ADF8LX8wjMMbtcb4IJMufWCnCcXORhbo9QMuyiybdtx; "
+ "path=/; expires=Mon, 28 Nov 2016 13:56:01 GMT; secure; HttpOnly";
[GlobalSetup]
public void GlobalSetup()
{
ResourceLeakDetector.Level = ResourceLeakDetector.DetectionLevel.Disabled;
}
[Benchmark]
public ICookie DecodeCookieWithRfc1123ExpiresField() => ClientCookieDecoder.StrictDecoder.Decode(CookieString);
}
}