mirror of
https://github.com/Azure/DotNetty.git
synced 2026-10-21 08:19:58 +08:00
1cdaadbfaa
- microsoft.extensions.logging 5.0.0 - microsoft.extensions.configuration 5.0.0
37 lines
1.0 KiB
C#
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);
|
|
}
|
|
}
|