Closed EgorBo closed 1 month ago
AzureIntel
BenchmarkDotNet v0.14.0, Ubuntu 22.04.5 LTS (Jammy Jellyfish)
Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 4 logical and 2 physical cores
Job-FWQIAL : .NET 9.0.0 (9.0.24.43107), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Server=True StdDev=2.83 ns
Method | Mean | Error | Gen0 | Allocated |
---|---|---|---|---|
Md5Cng | 945.7 ns | 3.20 ns | 0.0038 | 40 B |
AzureAmpere
BenchmarkDotNet v0.14.0, Ubuntu 22.04.5 LTS (Jammy Jellyfish)
AzureAmpere
Job-CMYGHR : .NET 9.0.0 (9.0.24.43107), Arm64 RyuJIT AdvSIMD
Server=True StdDev=0.0015 μs
Method | Mean | Error | Gen0 | Allocated |
---|---|---|---|---|
Md5Cng | 1.363 μs | 0.0016 μs | 0.0038 | - |
@EgorBot -mono -intel -arm64 -pr 108572 --envvars MONO_ENV_OPTIONS:--interpreter
using System.Runtime.CompilerServices;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
public class Benchmarks
{
static bool[] _values = Enumerable.Range(0, 256).Select(i => i % 2 == 0).ToArray();
static char[] _output = new char[4096];
[Benchmark]
public void WriteBools()
{
Span<char> output = _output;
foreach (var value in _values)
{
if (value.TryFormat(output, out int written))
output = output.Slice(written);
else
throw new InvalidOperationException();
}
Consume(output);
}
[MethodImpl(MethodImplOptions.NoInlining)]
void Consume(Span<char> _){}
}
AzureIntel
BenchmarkDotNet v0.14.0, Ubuntu 22.04.5 LTS (Jammy Jellyfish)
Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 16 logical and 8 physical cores
Job-WXWYDU : .NET 10.0.0 (42.42.42.42424) using MonoVM, X64 AOT
Job-BZFLRC : .NET 10.0.0 (42.42.42.42424) using MonoVM, X64 AOT
EnvironmentVariables=MONO_ENV_OPTIONS=--interpreter
Method | Toolchain | Mean | Error | Ratio |
---|---|---|---|---|
WriteBools | Main | 14.69 μs | 0.004 μs | 1.00 |
WriteBools | PR | 16.73 μs | 0.011 μs | 1.14 |
AzureAmpere
BenchmarkDotNet v0.14.0, Ubuntu 22.04.5 LTS (Jammy Jellyfish)
AzureAmpere
Job-KDLCFU : .NET 10.0.0 (42.42.42.42424) using MonoVM, Arm64 AOT
Job-MNYNZS : .NET 10.0.0 (42.42.42.42424) using MonoVM, Arm64 AOT
EnvironmentVariables=MONO_ENV_OPTIONS=--interpreter RatioSD=0.02
Method | Toolchain | Mean | Error | Ratio |
---|---|---|---|---|
WriteBools | Main | 21.05 μs | 0.396 μs | 1.00 |
WriteBools | PR | 27.53 μs | 0.290 μs | 1.31 |
@EgorBot -commit main -profiler -gv4
using System.Text.Json;
using BenchmarkDotNet.Attributes;
public class Perf_Basic
{
static readonly Employee[] Data = Enumerable.Range(1, 4096)
.Select(i => new Employee("John", "Manager", 30, 185.5, new DateTime(1990, 10, 10),
new Employee("Джон", "Разработчик", 30 + i, 185.5, new DateTime(1990, 10, 10), null))).ToArray();
[Benchmark]
public Employee[]? JsonRoundtrip()
{
var str = JsonSerializer.Serialize(Data);
return JsonSerializer.Deserialize<Employee[]>(str);
}
}
public record Employee(string name, string title, int age, double height, DateTime applyDate, Employee? manager);
AwsGraviton4
BenchmarkDotNet v0.14.0, Ubuntu 24.04 LTS (Noble Numbat)
AwsGraviton4
Job-ZUYKRT : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
Job=Job-ZUYKRT Toolchain=CoreRun StdDev=0.030 ms
Method | Mean | Error |
---|---|---|
JsonRoundtrip | 10.59 ms | 0.032 ms |
Perf_Basic_JsonRoundtrip
:Flame graphs: Main 🔥 Speedscope: Main Hot asm: Main Hot functions: Main Counters: Main
@EgorBot -commit main -profiler -gv4
using System.Text.Json;
using BenchmarkDotNet.Attributes;
public class Perf_Basic
{
static readonly Employee[] Data = Enumerable.Range(1, 4096)
.Select(i => new Employee("John", "Manager", 30, 185.5, new DateTime(1990, 10, 10),
new Employee("Джон", "Разработчик", 30 + i, 185.5, new DateTime(1990, 10, 10), null))).ToArray();
[Benchmark]
public Employee[]? JsonRoundtrip()
{
var str = JsonSerializer.Serialize(Data);
return JsonSerializer.Deserialize<Employee[]>(str);
}
}
public record Employee(string name, string title, int age, double height, DateTime applyDate, Employee? manager);
AwsGraviton4
BenchmarkDotNet v0.14.0, Ubuntu 24.04 LTS (Noble Numbat)
AwsGraviton4
Job-CRRQZV : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
Job=Job-CRRQZV Toolchain=CoreRun StdDev=0.028 ms
Method | Mean | Error |
---|---|---|
JsonRoundtrip | 10.52 ms | 0.030 ms |
Perf_Basic_JsonRoundtrip
:Flame graphs: Main 🔥 Speedscope: Main Hot asm: Main Hot functions: Main Counters: Main
@EgorBot -help
Usage: @EgorBot [-%target%] [-profiler] [raw args for BDN] `C# snippet surrounded with triple ticks`
-%target%: Can be -arm64, -amd or -intel. Or multiple at once, e.g. '-arm64 -intel'
-intel is used when none of the targets are specified.
There are also experimental AWS targets.
-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
@EgorBot -commit main -profiler -gv4 -perf_events ld_align_lat
using System.Text.Json;
using BenchmarkDotNet.Attributes;
public class Perf_Basic
{
static readonly Employee[] Data = Enumerable.Range(1, 4096)
.Select(i => new Employee("John", "Manager", 30, 185.5, new DateTime(1990, 10, 10),
new Employee("Джон", "Разработчик", 30 + i, 185.5, new DateTime(1990, 10, 10), null))).ToArray();
[Benchmark]
public Employee[]? JsonRoundtrip()
{
var str = JsonSerializer.Serialize(Data);
return JsonSerializer.Deserialize<Employee[]>(str);
}
}
public record Employee(string name, string title, int age, double height, DateTime applyDate, Employee? manager);
AwsGraviton4
BenchmarkDotNet v0.14.0, Ubuntu 24.04 LTS (Noble Numbat)
AwsGraviton4
Job-ONZGDN : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
Job=Job-ONZGDN Toolchain=CoreRun StdDev=0.036 ms
Method | Mean | Error |
---|---|---|
JsonRoundtrip | 10.51 ms | 0.039 ms |
Perf_Basic_JsonRoundtrip
:Flame graphs: Main 🔥 Speedscope: Main Hot asm: Main Hot functions: Main Counters: Main
@EgorBot -intel -arm64