using System;
using System.Runtime.CompilerServices;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
BenchmarkRunner.Run<Bench>(args: args);
public class Bench
{
[Benchmark]
public void Foo()
{
for (int i = 0; i < 1000; i++)
Work<char>(1);
}
[MethodImpl(MethodImplOptions.NoInlining)]
static void Work<T>(int size) => GC.KeepAlive(GC.AllocateUninitializedArray<T>(size));
}
@EgorBot -intel -perf