Skip to content
This repository was archived by the owner on Feb 23, 2026. It is now read-only.
This repository was archived by the owner on Feb 23, 2026. It is now read-only.

Benchmarks for #116109 (jkotas) #370

Open

Description

@EgorBot

Processing dotnet/runtime#116109 (comment) command:

Command

-intel

using BenchmarkDotNet.Attributes;

public class Bench
{
    int[] a = new int[10000];
    Comparison<int> c = (int x, int y) => x - y;

    [IterationSetup]
    public void IterationSetup() { for (int i = 0; i < a.Length; i++) a[i] = i; }

    [Benchmark]
    public void Sort() => Array.Sort(a, c);
}

(EgorBot will reply in this issue)

Activity

  1. EgorBot commented on May 31, 2025

    @EgorBot
    OwnerAuthor

    Benchmark results on linux_azure_cascadelake

    BenchmarkDotNet v0.14.0, Ubuntu 24.04.2 LTS (Noble Numbat)
    Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 8 logical and 4 physical cores
      Job-JNIADS : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
      Job-MOWRML : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
    InvocationCount=1  UnrollFactor=1
    
    Method Toolchain Mean Error Ratio
    Sort Main 272.6 μs 5.41 μs 1.00
    Sort PR 302.3 μs 6.03 μs 1.11

    BDN_Artifacts.zip

    cc @jkotas (agent_logs.txt). EgorBot manual: link.

  2. am11 commented on May 31, 2025

    @am11

    @EgorBot -intel

    // checking allocations
    using BenchmarkDotNet.Attributes;
    using BenchmarkDotNet.Running;
    using System.Runtime.CompilerServices;
    
    BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);
    
    [MemoryDiagnoser(false)]
    public class Bench
    {
        int[] a = new int[10000];
        Comparison<int> c = (int x, int y) => x - y;
    
        [IterationSetup]
        public void IterationSetup() { for (int i = 0; i < a.Length; i++) a[i] = i; }
    
        [Benchmark]
        public void Sort() => Array.Sort(a, c);
    }
  3. EgorBot commented on May 31, 2025

    @EgorBot
    OwnerAuthor

    Benchmark results on linux_azure_cascadelake

    BenchmarkDotNet v0.14.0, Ubuntu 24.04.2 LTS (Noble Numbat)
    Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 8 logical and 4 physical cores
      Job-PVSWRK : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
      Job-JSRHFA : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
    InvocationCount=1  UnrollFactor=1  RatioSD=0.02
    
    Method Toolchain Mean Error Ratio Allocated Alloc Ratio
    Sort Main 268.6 μs 4.84 μs 1.00 64 B 1.00
    Sort PR 292.6 μs 4.96 μs 1.09 736 B 11.50

    BDN_Artifacts.zip

    cc @am11 (agent_logs.txt). EgorBot manual: link.

  4. 2A5F commented on May 31, 2025

    @2A5F

    @EgorBot -intel

    using BenchmarkDotNet.Attributes;
    using BenchmarkDotNet.Running;
    using System.Runtime.CompilerServices;
    
    BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);
    
    [MemoryDiagnoser(false)]
    [DisassemblyDiagnoser]
    public class Bench
    {
        int[] a = new int[10000];
        Comparison<int> c = (int x, int y) => x - y;
    
        [IterationSetup]
        public void IterationSetup() { for (int i = 0; i < a.Length; i++) a[i] = i; }
    
        [Benchmark]
        public void Sort() => Array.Sort(a, c);
    }
  5. EgorBot commented on May 31, 2025

    @EgorBot
    OwnerAuthor

    Benchmark results on linux_azure_cascadelake

    BenchmarkDotNet v0.14.0, Ubuntu 24.04.2 LTS (Noble Numbat)
    Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 8 logical and 4 physical cores
      Job-YDMSYJ : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
      Job-CNLXFW : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
    InvocationCount=1  UnrollFactor=1  RatioSD=0.03
    
    Method Toolchain Mean Error Ratio Code Size Allocated Alloc Ratio
    Sort Main 267.0 μs 5.19 μs 1.00 49 B 64 B 1.00
    Sort PR 275.8 μs 3.79 μs 1.03 49 B 64 B 1.00

    BDN_Artifacts.zip

    cc @2A5F (agent_logs.txt). EgorBot manual: link.

  6. 2A5F commented on May 31, 2025

    @2A5F

    @EgorBot -intel

    using BenchmarkDotNet.Attributes;
    using BenchmarkDotNet.Running;
    using System.Runtime.CompilerServices;
    
    BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);
    
    [MemoryDiagnoser(false)]
    [DisassemblyDiagnoser(maxDepth: 1000, printSource: true, exportCombinedDisassemblyReport: true, exportDiff: true)]
    public class Bench
    {
        int[] a = new int[10000];
        Comparison<int> c = (int x, int y) => x - y;
    
        [IterationSetup]
        public void IterationSetup() { for (int i = 0; i < a.Length; i++) a[i] = i; }
    
        [Benchmark]
        public void Sort() => Array.Sort(a, c);
    }
  7. 2A5F commented on May 31, 2025

    @2A5F

    @EgorBot -intel --envvars DOTNET_JitDisasm:Sort

    using BenchmarkDotNet.Attributes;
    using BenchmarkDotNet.Running;
    using System.Runtime.CompilerServices;
    
    BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);
    
    [MemoryDiagnoser(false)]
    public class Bench
    {
        int[] a = new int[10000];
        Comparison<int> c = (int x, int y) => x - y;
    
        [IterationSetup]
        public void IterationSetup() { for (int i = 0; i < a.Length; i++) a[i] = i; }
    
        [Benchmark]
        public void Sort() => Array.Sort(a, c);
    }
  8. EgorBot commented on May 31, 2025

    @EgorBot
    OwnerAuthor

    Benchmark results on linux_azure_cascadelake

    BenchmarkDotNet v0.14.0, Ubuntu 24.04.2 LTS (Noble Numbat)
    Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 8 logical and 4 physical cores
      Job-QHTRQH : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
      Job-LXFKJI : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
    EnvironmentVariables=DOTNET_JitDisasm=Sort  InvocationCount=1  UnrollFactor=1
    
    Method Toolchain Mean Error Ratio Allocated Alloc Ratio
    Sort Main 274.7 μs 5.45 μs 1.00 64 B 1.00
    Sort PR 277.0 μs 3.49 μs 1.01 64 B 1.00

    BDN_Artifacts.zip

    cc @2A5F (agent_logs.txt). EgorBot manual: link.

  9. 2A5F commented on May 31, 2025

    @2A5F

    @EgorBot -intel

    using BenchmarkDotNet.Attributes;
    using BenchmarkDotNet.Running;
    using System.Runtime.CompilerServices;
    
    BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);
    
    [MemoryDiagnoser(false)]
    [DisassemblyDiagnoser(maxDepth: 1000, printSource: true, exportCombinedDisassemblyReport: true, exportDiff: true)]
    public class Bench
    {
        int[] a = new int[10000];
        Comparison<int> c = (int x, int y) => x - y;
    
        [IterationSetup]
        public void IterationSetup() { for (int i = 0; i < a.Length; i++) a[i] = i; }
    
        [Benchmark]
        public void Sort() => Array.Sort(a, c);
    }
  10. 2A5F commented on May 31, 2025

    @2A5F

    @EgorBot -intel

    using BenchmarkDotNet.Attributes;
    using BenchmarkDotNet.Running;
    using System.Runtime.CompilerServices;
    
    BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);
    
    [MemoryDiagnoser(false)]
    public class Bench
    {
        int[] a = new int[10000];
        Comparison<int> d = (int x, int y) => x - y;
        CompClass c = new();
    
        class CompClass : IComparer<int>
        {
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public int Compare(int x, int y) => x - y;
        }
        
        struct CompStruct : IComparer<int>
        {
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public int Compare(int x, int y) => x - y;
        }
    
        [IterationSetup]
        public void IterationSetup() { for (int i = 0; i < a.Length; i++) a[i] = i; }
    
        [Benchmark]
        public void ArraySortDefault() => Array.Sort(a);
        
        [Benchmark]
        public void ArraySortDelegate() => Array.Sort(a, d);
    
        [Benchmark]
        public void ArraySortClass() => Array.Sort(a, c);
    
        [Benchmark]
        public void SpanSortDefault() => a.AsSpan().Sort();
    
        [Benchmark]
        public void SpanSortDelegate() => a.AsSpan().Sort(d);
    
        [Benchmark]
        public void SpanSortClass() => a.AsSpan().Sort(c);
    
        [Benchmark]
        public void SortStruct() => a.AsSpan().Sort(new CompStruct());
    }
  11. EgorBot commented on May 31, 2025

    @EgorBot
    OwnerAuthor

    Benchmark results on linux_azure_cascadelake

    BenchmarkDotNet v0.14.0, Ubuntu 24.04.2 LTS (Noble Numbat)
    Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 8 logical and 4 physical cores
      Job-UGIJPW : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
      Job-MYXYSM : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
    InvocationCount=1  UnrollFactor=1
    
    Method Toolchain Mean Error Ratio Allocated Alloc Ratio
    ArraySortDefault Main 62.61 μs 0.232 μs 1.00 64 B 1.00
    ArraySortDefault PR 49.54 μs 0.755 μs 0.79 64 B 1.00
    ArraySortDelegate Main 273.28 μs 5.319 μs 1.00 64 B 1.00
    ArraySortDelegate PR 276.98 μs 4.789 μs 1.01 64 B 1.00
    ArraySortClass Main 270.28 μs 5.242 μs 1.00 512 B 1.00
    ArraySortClass PR 356.31 μs 7.105 μs 1.32 64 B 0.12
    SpanSortDefault Main 62.78 μs 0.352 μs 1.00 64 B 1.00
    SpanSortDefault PR 49.31 μs 0.303 μs 0.79 64 B 1.00
    SpanSortDelegate Main 277.98 μs 5.557 μs 1.00 64 B 1.00
    SpanSortDelegate PR 278.63 μs 4.556 μs 1.01 400 B 6.25
    SpanSortClass Main 270.43 μs 5.218 μs 1.00 512 B 1.00
    SpanSortClass PR 360.70 μs 5.451 μs 1.33 64 B 0.12
    SortStruct Main 385.01 μs 7.701 μs 1.00 536 B 1.00
    SortStruct PR 799.91 μs 15.994 μs 2.08 64 B 0.12

    BDN_Artifacts.zip

    cc @2A5F (agent_logs.txt). EgorBot manual: link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions