EgorBot / runtime-utils

MIT License
0 stars 1 forks source link

Test #89

Open EgorBo opened 1 week ago

EgorBo commented 1 week ago

@EgorBot -intel --envvars DOTNET_JitDisasm:TernLog --runtimes net8.0 net9.0

using System.Runtime.Intrinsics;
using BenchmarkDotNet.Attributes;

public class Bench
{
    byte[] a = new byte[1024];
    byte[] b = new byte[1024];
    byte[] c = new byte[1024];

    [Benchmark]
    public void TernLog()
    {
        ref byte bA = ref a[0];
        ref byte bB = ref b[0];
        ref byte bC = ref c[0];
        for (nuint i = 0; i < 1024; i+=64)
        {
            var v1 = Vector512.LoadUnsafe(ref bA, i);
            var v2 = Vector512.LoadUnsafe(ref bB, i);
            var v3 = Vector512.LoadUnsafe(ref bC, i);
            (v1 & v2 ^ v3).StoreUnsafe(ref bA, i);
        }
    }
}
EgorBot commented 1 week ago

Benchmark results on AzureIntel

BenchmarkDotNet v0.14.0, Ubuntu 22.04.4 LTS (Jammy Jellyfish)
Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 4 logical and 2 physical cores
  Job-GNQZSD : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
  Job-YCNKIV : .NET 9.0.0 (9.0.24.40507), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
EnvironmentVariables=DOTNET_JitDisasm=TernLog
Method Runtime Mean Error Ratio
TernLog .NET 8.0 35.68 ns 0.004 ns 1.00
TernLog .NET 9.0 26.24 ns 0.006 ns 0.74

BDN_Artifacts.zip

EgorBot commented 1 week ago

cc @EgorBo (logs)

EgorBo commented 1 week ago

Codegen diff: https://www.diffchecker.com/F45CXxJW/

EgorBo commented 3 days ago

@EgorBot -intel -arm64 -pr 107831

using BenchmarkDotNet.Attributes;

public class Bench
{
    [Benchmark]
    public int CountSymbols()
    {
        int count = 0;
        foreach (var c in "\t\tHello world\n\nSome text...\n")
            count += Test(c) ? 1 : 0;
        return count;
    }

    bool Test(char c)
    {
        if (c is ' ' or '\t' or '\r' or '\n' or '.')
            return true;
        return false;
    }
}
EgorBo commented 3 days ago

@EgorBot -intel -arm64 -pr 107831

using BenchmarkDotNet.Attributes;

public class Bench
{
    [Benchmark]
    public int CountSymbols()
    {
        int count = 0;
        foreach (var c in "\t\tHello world\n\nSome text...\n")
            count += Test(c) ? 1 : 0;
        return count;
    }

    bool Test(char c)
    {
        if (c is ' ' or '\t' or '\r' or '\n' or '.')
            return true;
        return false;
    }
}
EgorBot commented 3 days ago

Benchmark results on AzureIntel

BenchmarkDotNet v0.14.0, Ubuntu 22.04.4 LTS (Jammy Jellyfish)
Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 16 logical and 8 physical cores
  Job-CODODF : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
  Job-CJIWZO : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Method Toolchain Mean Error Ratio
CountSymbols Main 61.53 ns 0.208 ns 1.00
CountSymbols PR 59.67 ns 0.027 ns 0.97

BDN_Artifacts.zip

EgorBot commented 3 days ago

cc @EgorBo (logs)

EgorBot commented 3 days ago

Benchmark results on AzureAmpere

BenchmarkDotNet v0.14.0, Ubuntu 22.04.4 LTS (Jammy Jellyfish)
AzureAmpere
  Job-WEKMJI : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
  Job-FQBLQA : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
Method Toolchain Mean Error Ratio
CountSymbols Main 70.78 ns 0.005 ns 1.00
CountSymbols PR 70.80 ns 0.007 ns 1.00

BDN_Artifacts.zip

EgorBot commented 3 days ago

cc @EgorBo (logs)

EgorBot commented 3 days ago

Benchmark results on AzureIntel

BenchmarkDotNet v0.14.0, Ubuntu 22.04.4 LTS (Jammy Jellyfish)
Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 16 logical and 8 physical cores
  Job-EXYRDP : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
  Job-DEBFBF : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Method Toolchain Mean Error Ratio
CountSymbols Main 61.46 ns 0.109 ns 1.00
CountSymbols PR 59.38 ns 0.007 ns 0.97

BDN_Artifacts.zip

EgorBot commented 3 days ago

cc @EgorBo (logs)

EgorBot commented 3 days ago

Benchmark results on AzureAmpere

BenchmarkDotNet v0.14.0, Ubuntu 22.04.4 LTS (Jammy Jellyfish)
AzureAmpere
  Job-SPXIWE : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
  Job-YRTNLE : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
Method Toolchain Mean Error Ratio
CountSymbols Main 70.77 ns 0.020 ns 1.00
CountSymbols PR 70.66 ns 0.006 ns 1.00

BDN_Artifacts.zip

EgorBot commented 3 days ago

cc @EgorBo (logs)

EgorBo commented 2 days ago

@EgorBot -intel --runtimes net8.0 net9.0

using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text.Json.Nodes;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Diagnosers;

BenchmarkRunner.Run<JsonNodeBenchmarks>(args: args);

[MemoryDiagnoser]
public class JsonNodeBenchmarks
{
    [Benchmark]
    public JsonObject CreateJsonObject()
    {
        return new JsonObject()
        {
            ["applicationVersion"] = "1.2.3",
            ["frameworkDescription"] = RuntimeInformation.FrameworkDescription,
            ["operatingSystem"] = new JsonObject()
            {
                ["description"] = RuntimeInformation.OSDescription,
                ["architecture"] = RuntimeInformation.OSArchitecture.ToString(),
                ["version"] = Environment.OSVersion.VersionString,
                ["is64Bit"] = Environment.Is64BitOperatingSystem,
            },
            ["process"] = new JsonObject()
            {
                ["architecture"] = RuntimeInformation.ProcessArchitecture.ToString(),
                ["is64BitProcess"] = Environment.Is64BitProcess,
                ["isNativeAoT"] = !RuntimeFeature.IsDynamicCodeSupported,
                ["isPrivilegedProcess"] = Environment.IsPrivilegedProcess,
            },
        };
    }
}
EgorBot commented 2 days ago

Benchmark results on 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-EGGJLN : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
  Job-INWFFV : .NET 9.0.0 (9.0.24.43107), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Method Runtime Mean Error Ratio Gen0 Allocated Alloc Ratio
CreateJsonObject .NET 8.0 521.5 ns 1.14 ns 1.00 0.0505 1.24 KB 1.00
CreateJsonObject .NET 9.0 934.5 ns 2.82 ns 1.79 0.0858 2.12 KB 1.70

BDN_Artifacts.zip

EgorBot commented 2 days ago

cc @EgorBo (logs)

EgorBo commented 2 days ago

@EgorBot -intel --runtimes net8.0 net9.0 --envvars DOTNET_GCDynamicAdaptationMode=0

using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text.Json.Nodes;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Diagnosers;

BenchmarkRunner.Run<JsonNodeBenchmarks>(args: args);

[MemoryDiagnoser]
public class JsonNodeBenchmarks
{
    [Benchmark]
    public JsonObject CreateJsonObject()
    {
        return new JsonObject()
        {
            ["applicationVersion"] = "1.2.3",
            ["frameworkDescription"] = RuntimeInformation.FrameworkDescription,
            ["operatingSystem"] = new JsonObject()
            {
                ["description"] = RuntimeInformation.OSDescription,
                ["architecture"] = RuntimeInformation.OSArchitecture.ToString(),
                ["version"] = Environment.OSVersion.VersionString,
                ["is64Bit"] = Environment.Is64BitOperatingSystem,
            },
            ["process"] = new JsonObject()
            {
                ["architecture"] = RuntimeInformation.ProcessArchitecture.ToString(),
                ["is64BitProcess"] = Environment.Is64BitProcess,
                ["isNativeAoT"] = !RuntimeFeature.IsDynamicCodeSupported,
                ["isPrivilegedProcess"] = Environment.IsPrivilegedProcess,
            },
        };
    }
}
EgorBot commented 2 days ago

❌ Failed on AzureIntel: Benchmark run failed

cc @EgorBo (logs)

EgorBo commented 2 days ago

@EgorBot -intel --runtimes net8.0 net9.0 --envvars DOTNET_GCDynamicAdaptationMode:0 DOTNET_ReadyToRun:0 DOTNET_TieredCompilation:0

using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text.Json.Nodes;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Diagnosers;

BenchmarkRunner.Run<JsonNodeBenchmarks>(args: args);

[MemoryDiagnoser]
public class JsonNodeBenchmarks
{
    [Benchmark]
    public JsonObject CreateJsonObject()
    {
        return new JsonObject()
        {
            ["applicationVersion"] = "1.2.3",
            ["frameworkDescription"] = RuntimeInformation.FrameworkDescription,
            ["operatingSystem"] = new JsonObject()
            {
                ["description"] = RuntimeInformation.OSDescription,
                ["architecture"] = RuntimeInformation.OSArchitecture.ToString(),
                ["version"] = Environment.OSVersion.VersionString,
                ["is64Bit"] = Environment.Is64BitOperatingSystem,
            },
            ["process"] = new JsonObject()
            {
                ["architecture"] = RuntimeInformation.ProcessArchitecture.ToString(),
                ["is64BitProcess"] = Environment.Is64BitProcess,
                ["isNativeAoT"] = !RuntimeFeature.IsDynamicCodeSupported,
                ["isPrivilegedProcess"] = Environment.IsPrivilegedProcess,
            },
        };
    }
}
EgorBot commented 2 days ago

Benchmark results on 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-YMTETL : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
  Job-ZEKBEW : .NET 9.0.0 (9.0.24.43107), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
EnvironmentVariables=DOTNET_GCDynamicAdaptationMode=0,DOTNET_ReadyToRun=0,DOTNET_TieredCompilation=0
Method Runtime Mean Error Ratio Gen0 Allocated Alloc Ratio
CreateJsonObject .NET 8.0 603.5 ns 8.28 ns 1.00 0.0505 1.24 KB 1.00
CreateJsonObject .NET 9.0 1,103.5 ns 9.94 ns 1.83 0.0858 2.12 KB 1.70

BDN_Artifacts.zip

EgorBot commented 2 days ago

cc @EgorBo (logs)