mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-20 03:24:33 +08:00
added benchmark option to compare netfx and core runtime
This commit is contained in:
+2
-5
@@ -3,20 +3,17 @@ using BenchmarkDotNet.Configs;
|
|||||||
using BenchmarkDotNet.Jobs;
|
using BenchmarkDotNet.Jobs;
|
||||||
using BenchmarkDotNet.Validators;
|
using BenchmarkDotNet.Validators;
|
||||||
|
|
||||||
namespace MQTTnet.Benchmarks
|
namespace MQTTnet.Benchmarks.Configurations
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// this options may be used to run benchmarks in debugmode and attach a performance profiler
|
/// this options may be used to run benchmarks in debugmode and attach a performance profiler
|
||||||
/// https://benchmarkdotnet.org/Configs/Configs.htm
|
/// https://benchmarkdotnet.org/Configs/Configs.htm
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class AllowNonOptimized : ManualConfig
|
public class AllowNonOptimized : BaseConfig
|
||||||
{
|
{
|
||||||
public AllowNonOptimized()
|
public AllowNonOptimized()
|
||||||
{
|
{
|
||||||
Add(JitOptimizationsValidator.DontFailOnError); // ALLOW NON-OPTIMIZED DLLS
|
Add(JitOptimizationsValidator.DontFailOnError); // ALLOW NON-OPTIMIZED DLLS
|
||||||
Add(DefaultConfig.Instance.GetLoggers().ToArray()); // manual config has no loggers by default
|
|
||||||
Add(DefaultConfig.Instance.GetExporters().ToArray()); // manual config has no exporters by default
|
|
||||||
Add(DefaultConfig.Instance.GetColumnProviders().ToArray()); // manual config has no columns by default
|
|
||||||
Add(Job.InProcess);
|
Add(Job.InProcess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using BenchmarkDotNet.Configs;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace MQTTnet.Benchmarks.Configurations
|
||||||
|
{
|
||||||
|
public class BaseConfig : ManualConfig
|
||||||
|
{
|
||||||
|
public BaseConfig()
|
||||||
|
{
|
||||||
|
Add(DefaultConfig.Instance.GetLoggers().ToArray()); // manual config has no loggers by default
|
||||||
|
Add(DefaultConfig.Instance.GetExporters().ToArray()); // manual config has no exporters by default
|
||||||
|
Add(DefaultConfig.Instance.GetColumnProviders().ToArray()); // manual config has no columns by default
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using BenchmarkDotNet.Configs;
|
||||||
|
using BenchmarkDotNet.Environments;
|
||||||
|
using BenchmarkDotNet.Jobs;
|
||||||
|
using BenchmarkDotNet.Toolchains.CsProj;
|
||||||
|
|
||||||
|
namespace MQTTnet.Benchmarks.Configurations
|
||||||
|
{
|
||||||
|
public class RuntimeCompareConfig : BaseConfig
|
||||||
|
{
|
||||||
|
public RuntimeCompareConfig()
|
||||||
|
{
|
||||||
|
Add(Job.Default.With(Runtime.Clr));
|
||||||
|
Add(Job.Default.With(Runtime.Core).With(CsProjCoreToolchain.NetCoreApp21));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using BenchmarkDotNet.Running;
|
using BenchmarkDotNet.Running;
|
||||||
|
using MQTTnet.Benchmarks.Configurations;
|
||||||
using MQTTnet.Diagnostics;
|
using MQTTnet.Diagnostics;
|
||||||
|
|
||||||
namespace MQTTnet.Benchmarks
|
namespace MQTTnet.Benchmarks
|
||||||
@@ -43,7 +44,7 @@ namespace MQTTnet.Benchmarks
|
|||||||
BenchmarkRunner.Run<TcpPipesBenchmark>();
|
BenchmarkRunner.Run<TcpPipesBenchmark>();
|
||||||
break;
|
break;
|
||||||
case '8':
|
case '8':
|
||||||
BenchmarkRunner.Run<MessageProcessingMqttConnectionContextBenchmark>(new AllowNonOptimized());
|
BenchmarkRunner.Run<MessageProcessingMqttConnectionContextBenchmark>(new RuntimeCompareConfig()/*new AllowNonOptimized()*/);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user