Skip to content

Instantly share code, notes, and snippets.

@badamczewski
Created July 4, 2021 15:38
Show Gist options
  • Save badamczewski/6da6b71dcb6fc25b1ba76f7afe411172 to your computer and use it in GitHub Desktop.
Save badamczewski/6da6b71dcb6fc25b1ba76f7afe411172 to your computer and use it in GitHub Desktop.
bench.cs
public class Bench73
{
public int[] _a = new int[100_000];
[Benchmark(Baseline = true)]
[MethodImpl(MethodImplOptions.NoInlining)]
public void A()
{
for (int i = 0; i < 10000; i++)
_a[1] = 100;
}
[Benchmark()]
[MethodImpl(MethodImplOptions.NoInlining)]
public void B()
{
for (int i = 0; i < 10000; i++)
_a[10000] = 100;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment