Closed EgorBot closed 3 weeks ago
Arm64
BenchmarkDotNet v0.14.0, Ubuntu 24.04 LTS (Noble Numbat)
Arm64
Job-HBOXFZ : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
Job-TLGBNY : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
Method | Toolchain | Mean | Error | Ratio |
---|---|---|---|---|
Bench | Main | 3.067 ns | 0.0003 ns | 1.00 |
Bench | PR | 3.224 ns | 0.0007 ns | 1.05 |
Bencha_Bench
:Flame graphs: Main vs PR 🔥 Speedscope: Main vs PR Hot asm: Main vs PR Hot functions: Main vs PR Counters: Main vs PR
@EgorBot -win_amd --runtimes net8.0 net9.0
using BenchmarkDotNet.Attributes;
public class Bencha
{
static object obj = new MyClass();
[Benchmark]
public void Bench()
{
if (obj is MyClass myClass1)
myClass1.DoWork();
if (obj is MyClass myClass2)
myClass2.DoWork();
if (obj is MyClass myClass3)
myClass3.DoWork();
if (obj is MyClass myClass4)
myClass4.DoWork();
if (obj is MyClass myClass5)
myClass5.DoWork();
if (obj is MyClass myClass6)
myClass6.DoWork();
}
}
public class MyClass {
public virtual void DoWork() {}
}
@EgorBot -win_amd
using BenchmarkDotNet.Attributes;
public class Bencha
{
static object obj = new MyClass();
[Benchmark]
public void Bench()
{
if (obj is MyClass myClass1)
myClass1.DoWork();
if (obj is MyClass myClass2)
myClass2.DoWork();
if (obj is MyClass myClass3)
myClass3.DoWork();
if (obj is MyClass myClass4)
myClass4.DoWork();
if (obj is MyClass myClass5)
myClass5.DoWork();
if (obj is MyClass myClass6)
myClass6.DoWork();
}
}
public class MyClass {
public virtual void DoWork() {}
}
@EgorBot -win_amd
using BenchmarkDotNet.Attributes;
public class Bencha
{
static object obj = new MyClass();
[Benchmark]
public void Bench()
{
if (obj is MyClass myClass1)
myClass1.DoWork();
if (obj is MyClass myClass2)
myClass2.DoWork();
if (obj is MyClass myClass3)
myClass3.DoWork();
if (obj is MyClass myClass4)
myClass4.DoWork();
if (obj is MyClass myClass5)
myClass5.DoWork();
if (obj is MyClass myClass6)
myClass6.DoWork();
}
}
public class MyClass {
public virtual void DoWork() {}
}
@EgorBot -win_amd
using BenchmarkDotNet.Attributes;
public class Bencha
{
static object obj = new MyClass();
[Benchmark]
public void Bench()
{
if (obj is MyClass myClass1)
myClass1.DoWork();
if (obj is MyClass myClass2)
myClass2.DoWork();
if (obj is MyClass myClass3)
myClass3.DoWork();
if (obj is MyClass myClass4)
myClass4.DoWork();
if (obj is MyClass myClass5)
myClass5.DoWork();
if (obj is MyClass myClass6)
myClass6.DoWork();
}
}
public class MyClass {
public virtual void DoWork() {}
}
@EgorBot -win_amd
using BenchmarkDotNet.Attributes;
public class Bencha
{
static object obj = new MyClass();
[Benchmark]
public void Bench()
{
if (obj is MyClass myClass1)
myClass1.DoWork();
if (obj is MyClass myClass2)
myClass2.DoWork();
if (obj is MyClass myClass3)
myClass3.DoWork();
if (obj is MyClass myClass4)
myClass4.DoWork();
if (obj is MyClass myClass5)
myClass5.DoWork();
if (obj is MyClass myClass6)
myClass6.DoWork();
}
}
public class MyClass {
public virtual void DoWork() {}
}
AwsGenoa
BenchmarkDotNet v0.14.0, Windows 10 (10.0.20348.2762)
AMD EPYC 9R14, 1 CPU, 16 logical and 16 physical cores
DefaultJob : .NET 9.0.0 (9.0.24.47305), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
StdDev=0.0180 ns
Method | Mean | Error |
---|---|---|
Bench | 2.691 ns | 0.0193 ns |
@EgorBot -win_amd --runtimes net8.0 net9.0
using BenchmarkDotNet.Attributes;
public class Bencha
{
static object obj = new MyClass();
[Benchmark]
public void Bench()
{
if (obj is MyClass myClass1)
myClass1.DoWork();
if (obj is MyClass myClass2)
myClass2.DoWork();
if (obj is MyClass myClass3)
myClass3.DoWork();
if (obj is MyClass myClass4)
myClass4.DoWork();
if (obj is MyClass myClass5)
myClass5.DoWork();
if (obj is MyClass myClass6)
myClass6.DoWork();
}
}
public class MyClass {
public virtual void DoWork() {}
}
@EgorBot -win_amd --runtimes net8.0 net9.0
using BenchmarkDotNet.Attributes;
public class Bencha
{
static object obj = new MyClass();
[Benchmark]
public void Bench()
{
if (obj is MyClass myClass1)
myClass1.DoWork();
if (obj is MyClass myClass2)
myClass2.DoWork();
if (obj is MyClass myClass3)
myClass3.DoWork();
if (obj is MyClass myClass4)
myClass4.DoWork();
if (obj is MyClass myClass5)
myClass5.DoWork();
if (obj is MyClass myClass6)
myClass6.DoWork();
}
}
public class MyClass {
public virtual void DoWork() {}
}
Windows-Genoa
BenchmarkDotNet v0.14.0, Windows 10 (10.0.20348.2762)
AMD EPYC 9R14, 1 CPU, 16 logical and 16 physical cores
Job-HYEZIP : .NET 8.0.10 (8.0.1024.46610), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Job-HAATBL : .NET 9.0.0 (9.0.24.47305), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Method | Runtime | Mean | Error | Ratio |
---|---|---|---|---|
Bench | .NET 8.0 | 7.581 ns | 0.0006 ns | 1.00 |
Bench | .NET 9.0 | 2.680 ns | 0.0103 ns | 0.35 |
@EgorBot -win_amd --runtimes net8.0 net9.0
using BenchmarkDotNet.Attributes;
public class Bencha
{
seetatic object obj = new MyClass();
[Benchmark]
public void Bench()
{
if (obj is MyClass myClass1)
myClass1.DoWork();
if (obj is MyClass myClass2)
myClass2.DoWork();
if (obj is MyClass myClass3)
myClass3.DoWork();
if (obj is MyClass myClass4)
myClass4.DoWork();
if (obj is MyClass myClass5)
myClass5.DoWork();
if (obj is MyClass myClass6)
myClass6.DoWork();
}
}
public class MyClass {
public virtual void DoWork() {}
}
@EgorBot -win_amd --runtimes net8.0 net9.0
using BenchmarkDotNet.Attributes;
public class Bencha
{
seetatic object obj = new MyClass();
[Benchmark]
public void Bench()
{
if (obj is MyClass myClass1)
myClass1.DoWork();
if (obj is MyClass myClass2)
myClass2.DoWork();
if (obj is MyClass myClass3)
myClass3.DoWork();
if (obj is MyClass myClass4)
myClass4.DoWork();
if (obj is MyClass myClass5)
myClass5.DoWork();
if (obj is MyClass myClass6)
myClass6.DoWork();
}
}
public class MyClass {
public virtual void DoWork() {}
}
@EgorBot -win_amd --runtimes net8.0 net9.0
using BenchmarkDotNet.Attributes;
public class Bencha
{
static object obj = new MyClass();
[Benchmark]
public void Bench()
{
if (obj is MyClass myClass1)
myClass1.DoWork();
if (obj is MyClass myClass2)
myClass2.DoWork();
if (obj is MyClass myClass3)
myClass3.DoWork();
if (obj is MyClass myClass4)
myClass4.DoWork();
if (obj is MyClass myClass5)
myClass5.DoWork();
if (obj is MyClass myClass6)
myClass6.DoWork();
}
}
public class MyClass {
public virtual void DoWork() {}
}
@EgorBot -win_amd --runtimes net8.0 net9.0
using BenchmarkDotNet.Attributes;
public class Bencha
{
static object obj = new MyClass();
[Benchmark]
public void Bench()
{
if (obj is MyClass myClass1)
myClass1.DoWork();
if (obj is MyClass myClass2)
myClass2.DoWork();
if (obj is MyClass myClass3)
myClass3.DoWork();
if (obj is MyClass myClass4)
myClass4.DoWork();
if (obj is MyClass myClass5)
myClass5.DoWork();
if (obj is MyClass myClass6)
myClass6.DoWork();
}
}
public class MyClass {
public virtual void DoWork() {}
}
@EgorBot -win_amd --runtimes net8.0 net9.0
using BenchmarkDotNet.Attributes;
public class Bencha
{
static object obj = new MyClass();
[Benchmark]
public void Bench()
{
if (obj is MyClass myClass1)
myClass1.DoWork();
if (obj is MyClass myClass2)
myClass2.DoWork();
if (obj is MyClass myClass3)
myClass3.DoWork();
if (obj is MyClass myClass4)
myClass4.DoWork();
if (obj is MyClass myClass5)
myClass5.DoWork();
if (obj is MyClass myClass6)
myClass6.DoWork();
}
}
public class MyClass {
public virtual void DoWork() {}
}
Windows-Genoa
BenchmarkDotNet v0.14.0, Windows 10 (10.0.20348.2762)
AMD EPYC 9R14, 1 CPU, 16 logical and 16 physical cores
Job-FTJCUF : .NET 8.0.10 (8.0.1024.46610), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Job-JAXQST : .NET 9.0.0 (9.0.24.47305), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Method | Runtime | Mean | Error | Ratio |
---|---|---|---|---|
Bench | .NET 8.0 | 7.588 ns | 0.0037 ns | 1.00 |
Bench | .NET 9.0 | 2.680 ns | 0.0098 ns | 0.35 |
@EgorBot -win_amd --runtimes net8.0 net9.0
using BenchmarkDotNet.Attributes;
public class Bencha
{
statlllic object obj = new MyClass();
[Benchmark]
public void Bench()
{
if (obj is MyClass myClass1)
myClass1.DoWork();
if (obj is MyClass myClass2)
myClass2.DoWork();
if (obj is MyClass myClass3)
myClass3.DoWork();
if (obj is MyClass myClass4)
myClass4.DoWork();
if (obj is MyClass myClass5)
myClass5.DoWork();
if (obj is MyClass myClass6)
myClass6.DoWork();
}
}
public class MyClass {
public virtual void DoWork() {}
}
@EgorBot -win_arm64 --runtimes net8.0 net9.0
using BenchmarkDotNet.Attributes;
public class Bencha
{
static object obj = new MyClass();
[Benchmark]
public void Bench()
{
if (obj is MyClass myClass1)
myClass1.DoWork();
if (obj is MyClass myClass2)
myClass2.DoWork();
if (obj is MyClass myClass3)
myClass3.DoWork();
if (obj is MyClass myClass4)
myClass4.DoWork();
if (obj is MyClass myClass5)
myClass5.DoWork();
if (obj is MyClass myClass6)
myClass6.DoWork();
}
}
public class MyClass {
public virtual void DoWork() {}
}
❌ AwsGraviton4 can't be used with OS=Windows2022. See:
[azure_ampere] = [ubuntu2204, ubuntu2404], [azure_milano] = [ubuntu2204, ubuntu2404], [azure_icelake] = [ubuntu2204, ubuntu2404], [azure_cobalt100] = [ubuntu2204, ubuntu2404], [azure_genoa] = [ubuntu2204, ubuntu2404], [aws_graviton2] = [ubuntu2204, ubuntu2404], [aws_graviton3] = [ubuntu2204, ubuntu2404], [aws_graviton4] = [ubuntu2204, ubuntu2404], [aws_m2pro] = [macos], [aws_m1] = [macos], [aws_m1ultra] = [macos], [aws_m2] = [macos], [aws_macx86] = [macos], [aws_sapphirelake] = [windows, ubuntu2204, ubuntu2404], [aws_icelake] = [windows, ubuntu2204, ubuntu2404], [aws_genoa] = [windows, ubuntu2204, ubuntu2404], [aws_milano] = [windows, ubuntu2204, ubuntu2404],
cc @EgorBo
@EgorBot -win_amd -pr 109466
using BenchmarkDotNet.Attributes;
public class C
{
private static readonly int[] _perm = [1, 2, 3, 4];
private int Index = 1;
[Benchmark]
public int Hash()
{
int index = Index;
return _perm[index & (_perm.Length - 1)];
}
}
@EgorBot -win_amd -pr 109466
using BenchmarkDotNet.Attributes;
public class C
{
private static readonly int[] _perm = [1, 2, 3, 4];
private int Index = 1;
[Benchmark]
public int Hash()
{
int index = Index;
return _perm[index & (_perm.Length - 1)];
}
}
@EgorBot -win_amd -pr 109466
using BenchmarkDotNet.Attributes;
public class C
{
private static readonly int[] _perm = [1, 2, 3, 4];
private int Index = 1;
[Benchmark]
public int Hash()
{
int index = Index;
return _perm[index & (_perm.Length - 1)];
}
}
@EgorBot -linux_amd -arm64 -pr 109466
using BenchmarkDotNet.Attributes;
public class C
{
private static readonly int[] _perm = [1, 2, 3, 4];
private int Index = 1;
[Benchmark]
public int Hash()
{
int index = Index;
return _perm[index & (_perm.Length - 1)];
}
}
Linux-Genoa
BenchmarkDotNet v0.14.0, Ubuntu 24.04 LTS (Noble Numbat)
AMD EPYC 9R14, 1 CPU, 16 logical and 16 physical cores
Job-VHFPFT : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Job-LKZIRQ : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Method | Toolchain | Mean | Error | Ratio |
---|---|---|---|---|
Hash | Main | 0.2789 ns | 0.0191 ns | 1.00 |
Hash | PR | 0.0112 ns | 0.0118 ns | 0.04 |
Linux-Graviton4
BenchmarkDotNet v0.14.0, Ubuntu 24.04 LTS (Noble Numbat)
Arm64
Job-DHKDWN : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
Job-NWKPCJ : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
Method | Toolchain | Mean | Error | Ratio |
---|---|---|---|---|
Hash | Main | 0.1383 ns | 0.0012 ns | 1.00 |
Hash | PR | 0.1162 ns | 0.0016 ns | 0.84 |
Windows-Genoa
BenchmarkDotNet v0.14.0, Windows 10 (10.0.20348.2762)
AMD EPYC 9R14, 1 CPU, 16 logical and 16 physical cores
Job-MWHTTU : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
RatioSD=?
Method | Job | Toolchain | Mean | Error | Ratio |
---|---|---|---|---|---|
Hash | Job-NQEOWI | \core_root_base\corerun.exe | NA | NA | ? |
Hash | Job-MWHTTU | \core_root_diff\corerun.exe | 0.0022 ns | 0.0026 ns | ? |
Benchmarks with issues: C.Hash: Job-NQEOWI(Toolchain=\core_root_base\corerun.exe)
@EgorBot -win_amd -pr 109466
using BenchmarkDotNet.Attributes;
public class C
{
private static readonly int[] _perm = [1, 2, 3, 4];
private int Index = 1;
[Benchmark]
public int Hash()
{
int index = Index;
return _perm[index & (_perm.Length - 1)];
}
}
Windows-Genoa
BenchmarkDotNet v0.14.0, Windows 10 (10.0.20348.2762)
AMD EPYC 9R14, 1 CPU, 16 logical and 16 physical cores
Job-FETNAZ : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Job-HGBNVG : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Method | Job | Toolchain | Mean | Error | Ratio |
---|---|---|---|---|---|
Hash | Job-FETNAZ | \core_root_base\corerun.exe | 0.2753 ns | 0.0077 ns | 1.001 |
Hash | Job-HGBNVG | \core_root_diff\corerun.exe | 0.0001 ns | 0.0005 ns | 0.000 |
@EgorBot -win_arm -pr 109466
using BenchmarkDotNet.Attributes;
public class C
{
private static readonly int[] _perm = [1, 2, 3, 4];
private int Index = 1;
[Benchmark]
public int Hash()
{
int index = Index;
return _perm[index & (_perm.Length - 1)];
}
}
❌ AwsGraviton4 can't be used with OS=Windows2022. See:
[azure_ampere] = [ubuntu2204, ubuntu2404], [azure_milano] = [ubuntu2204, ubuntu2404], [azure_icelake] = [ubuntu2204, ubuntu2404], [azure_cobalt100] = [ubuntu2204, ubuntu2404], [azure_genoa] = [ubuntu2204, ubuntu2404], [aws_graviton2] = [ubuntu2204, ubuntu2404], [aws_graviton3] = [ubuntu2204, ubuntu2404], [aws_graviton4] = [ubuntu2204, ubuntu2404], [aws_m2pro] = [macos], [aws_m1] = [macos], [aws_m1ultra] = [macos], [aws_m2] = [macos], [aws_macx86] = [macos], [aws_sapphirelake] = [windows, ubuntu2204, ubuntu2404], [aws_icelake] = [windows, ubuntu2204, ubuntu2404], [aws_genoa] = [windows, ubuntu2204, ubuntu2404], [aws_milano] = [windows, ubuntu2204, ubuntu2404],
cc @EgorBo
@EgorBot -win_arm -pr 109466
using BenchmarkDotNet.Attributes;
public class C
{
private static readonly int[] _perm = [1, 2, 3, 4];
private int Index = 1;
[Benchmark]
public int Hash()
{
int index = Index;
return _perm[index & (_perm.Length - 1)];
}
}
@EgorBot -help
❌ AwsGraviton4 can't be used with OS=Windows2022. See:
Targets: OSes:
azure_ampere linux
azure_milano linux
azure_icelake linux
azure_cobalt100 linux
azure_genoa linux
aws_m1 macos
aws_m1ultra macos
aws_m2 macos
aws_m2pro macos
aws_macx86 macos
aws_sapphirelake linux, windows
aws_icelake linux, windows
aws_genoa linux, windows
aws_milano linux, windows
Usage: @EgorBot [-%target%] [-profiler] [raw args for BDN] `C# snippet surrounded with triple ticks`
-%target%: Can be -arm, -amd or -intel. Or multiple at once, e.g. '-arm64 -intel'
-intel is used when none of the targets are specified.
NOTE: target can be prefixed with the OS:
-linux_*
-windows_* (x64 only atm)
-macos_* (temporarily disabled)
Full list of targets (idiomatic names):
-azure_ampere (temporarily disabled)
-azure_cobalt100 (temporarily disabled)
-azure_milano (temporarily disabled)
-azure_icelake (temporarily disabled)
-aws_sapphirelake
-aws_icelake
-aws_genoa
-aws_milano
-aws_m1 (temporarily disabled)
-aws_m1ultra (temporarily disabled)
-aws_m2 (temporarily disabled)
-aws_m2pro (temporarily disabled)
short aliases:
-arm = -azure_ampere (temporarily changed to -aws_graviton4)
-intel = -azure_icelake (temporarily changed to -aws_sapphirelake)
-amd = -azure_milano (temporarily changed to -aws_genoa)
-profiler: Use 'perf record' to collect a flamegraph/hot asm.
-perf_events Exact events to collect with 'perf', e.g. -perf_events ld_align_lat
(events are target-specific, you can find the list of the supported events in BDN_Artifacts.zip
when you run a benchmark with -profiler arg).
-commit: E.g. '-commit 72ea87f vs 380898a' or just '-commit 72ea87f'
Runs the benchmark on the specified commit(s) (PR is ignored)
-mono: Use Mono runtime instead of CoreCLR for all targets. Should be possible to use
Mono interp too (LLVM is not supported yet).
Mono doesn't support -profiler (at least JIT)
To use mono-interp, use BDN args, e.g. --envvars MONO_ENV_OPTIONS:"--interpreter"
-nonativepgo: Disable native PGO (Build with /p:NoPgoOptimize=true)
-pr %num%: Run for changes in a specific PR. If bot is invoked from a PR - it takes changes
from that PR implicitly.
-[args for BDN]: Args directly passed to BDN e.g. '--disasm', see
https://github.com/dotnet/BenchmarkDotNet/blob/master/docs/articles/guides/console-args.md
All targets are Linux-only at the moment.
NOTE: BenchmarkRunner.Run
or BenchmarkSwitcher.From*
can be omitted (snippet without an entrypoint)
Although, if they're presented then Program's args must be be forwarded to Run(args: args)
NOTE: [DisassemblyDiagnoser]
may cause unexpected crashes in BDN on Linux (at least on x64)
Examples:
-intel -arm64 -perf --envvars DOTNET_JitDisasm:Foo
Usage example: link
cc @EgorBo
Processing https://github.com/dotnet/runtime/pull/109428#issuecomment-2452357005 command:
Command
-arm64 -profiler ```cs using BenchmarkDotNet.Attributes; public class Bencha { static object obj = new MyClass(); [Benchmark] public void Bench() { if (obj is MyClass myClass1) myClass1.DoWork(); if (obj is MyClass myClass2) myClass2.DoWork(); if (obj is MyClass myClass3) myClass3.DoWork(); if (obj is MyClass myClass4) myClass4.DoWork(); if (obj is MyClass myClass5) myClass5.DoWork(); if (obj is MyClass myClass6) myClass6.DoWork(); } } public class MyClass { public virtual void DoWork() {} } ```(EgorBot will reply in this issue)