19.04.2018 Performance Improvements in .NET Core 2.1
 
Performance Improvements in .NET Core 2.1

private static int[] s_intArray = Enumerable.Range(0, 100_000_000).ToArray();

[Benchmark(OperationsPerInvoke = 100_000_000)]
public int EqualityComparerInt32()
{
    int[] items = s_intArray;

    for (int i = 0; i < items.Length; i++)
        if (EqualityComparer<int>.Default.Equals(items[i], -1))
            return i;

    return -1;
}


On my machine, I get output like the following, showcasing an ~2.5x speedup over .NET Core 2.0:

Method Toolchain Mean
EqualityComparerInt32 .NET Core 2.0 2.2106 ns
EqualityComparerInt32 .NET Core 2.1 0.8725 ns


 
 
 
 
10.12  .NET Reactor
15.11  n
15.11  C# ClickOnce