Open EgorBo opened 1 week ago
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 |
Codegen diff: https://www.diffchecker.com/F45CXxJW/
@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 -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;
}
}
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 |
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 |
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 |
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 |
@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,
},
};
}
}
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 |
@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 -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,
},
};
}
}
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 |
@EgorBot -intel --envvars DOTNET_JitDisasm:TernLog --runtimes net8.0 net9.0