Files
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

37 lines
1.0 KiB
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.Internal
{
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using DotNetty.Common.Internal;
// [CoreJob]
[SimpleJob(RuntimeMoniker.NetCoreApp31)]
[BenchmarkCategory("Internal")]
public class PlatformDependentBenchmark
{
[Params(10, 50, 100, 1000, 10000, 100000)]
public int Size { get; set; }
byte[] bytes1;
byte[] bytes2;
[GlobalSetup]
public void GlobalSetup()
{
this.bytes1 = new byte[this.Size];
this.bytes2 = new byte[this.Size];
for (int i = 0; i < this.Size; i++)
{
this.bytes1[i] = this.bytes2[i] = (byte)i;
}
}
[Benchmark]
public bool UnsafeBytesEqual() =>
PlatformDependent.ByteArrayEquals(this.bytes1, 0, this.bytes2, 0, this.bytes1.Length);
}
}