Open EgorBo opened 2 weeks ago
@EgorBot -win_x64 --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();
}
}
public class MyClass {
public virtual void DoWork() {}
}
windows-sapphirelake
BenchmarkDotNet v0.14.0, Windows 10 (10.0.20348.2762)
Intel Xeon Platinum 8488C, 1 CPU, 16 logical and 8 physical cores
Job-YFGWZB : .NET 8.0.10 (8.0.1024.46610), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Job-FXRMLG : .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 | 2.8022 ns | 0.0309 ns | 1.00 |
Bench | .NET 9.0 | 0.5966 ns | 0.0112 ns | 0.21 |
@EgorBot -win_amd -commit 23b3d41 vs previous --filter System.Threading.Tasks.ValueTaskPerfTest.Copy_PassAsArgumentAndReturn_FromTask
windows-genoa
BenchmarkDotNet v0.14.1-nightly.20240924.187, Windows 10 (10.0.20348.2762)
AMD EPYC 9R14 2.60GHz, 1 CPU, 16 logical and 16 physical cores
Job-OYNOYU : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Job-SNLBCK : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
PowerPlanMode=00000000-0000-0000-0000-000000000000 IterationTime=250ms MaxIterationCount=20
MaxWarmupIterationCount=10 MinIterationCount=15 MinWarmupIterationCount=2
WarmupCount=-1
Method | Toolchain | Mean | Error | Ratio | Allocated | Alloc Ratio |
---|---|---|---|---|---|---|
Copy_PassAsArgumentAndReturn_FromTask | \core_root_base\corerun.exe | 5.731 ns | 0.0391 ns | 1.00 | - | NA |
Copy_PassAsArgumentAndReturn_FromTask | \core_root_diff\corerun.exe | 5.507 ns | 0.0335 ns | 0.96 | - | NA |
@EgorBot -win_x64 --runtimes net8.0 net9.0