Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EgorBot for AndyAyersMS in #109209 #142

Open
EgorBot opened this issue Oct 28, 2024 · 4 comments
Open

EgorBot for AndyAyersMS in #109209 #142

EgorBot opened this issue Oct 28, 2024 · 4 comments

Comments

@EgorBot
Copy link
Owner

EgorBot commented Oct 28, 2024

Processing dotnet/runtime#109209 (comment) command:

Command

-intel -arm64

using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Runtime.CompilerServices;

BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);

public class Bench
{
    string[] s_ro_str_array = new string[512];

    [Benchmark]
    public int Foreach()
    {
        IEnumerable<string> e = s_ro_str_array;
        int sum = 0;
        foreach (string s in e) sum += s == null ? 0 : s.Length;
        return sum;
    }

    [Benchmark]
    public int Count() => CountInner(s_ro_str_array);

    [MethodImpl(MethodImplOptions.NoInlining)]
    int CountInner(ICollection<string> c) => c.Count;
}

(EgorBot will reply in this issue)

@EgorBot
Copy link
Owner Author

EgorBot commented Oct 28, 2024

Benchmark results on Arm64

BenchmarkDotNet v0.14.0, Ubuntu 24.04 LTS (Noble Numbat)
Arm64
  Job-UXBTJA : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
  Job-VJTWZI : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
Method Toolchain Mean Error Ratio
Foreach Main 1,297.675 ns 0.0915 ns 1.00
Foreach PR 282.593 ns 0.8442 ns 0.22
Count Main 1.111 ns 0.0003 ns 1.00
Count PR 1.071 ns 0.0003 ns 0.96

BDN_Artifacts.zip

@EgorBot
Copy link
Owner Author

EgorBot commented Oct 28, 2024

cc @AndyAyersMS (logs)

@EgorBot
Copy link
Owner Author

EgorBot commented Oct 28, 2024

Benchmark results on Intel

BenchmarkDotNet v0.14.0, Ubuntu 24.04 LTS (Noble Numbat)
Intel Xeon Platinum 8488C, 1 CPU, 8 logical and 4 physical cores
  Job-GNMMMF : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
  Job-ZDWMNG : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Method Toolchain Mean Error Ratio
Foreach Main 382.5067 ns 1.2694 ns 1.00
Foreach PR 298.1094 ns 1.5452 ns 0.78
Count Main 3.7048 ns 0.0246 ns 1.00
Count PR 0.5671 ns 0.0118 ns 0.15

BDN_Artifacts.zip

@EgorBot
Copy link
Owner Author

EgorBot commented Oct 28, 2024

cc @AndyAyersMS (logs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant