diff --git a/Tests/MQTTnet.Benchmarks/AllowNonOptimized.cs b/Tests/MQTTnet.Benchmarks/Configurations/AllowNonOptimized.cs similarity index 54% rename from Tests/MQTTnet.Benchmarks/AllowNonOptimized.cs rename to Tests/MQTTnet.Benchmarks/Configurations/AllowNonOptimized.cs index ecb31a20..076d1e8d 100644 --- a/Tests/MQTTnet.Benchmarks/AllowNonOptimized.cs +++ b/Tests/MQTTnet.Benchmarks/Configurations/AllowNonOptimized.cs @@ -3,20 +3,17 @@ using BenchmarkDotNet.Configs; using BenchmarkDotNet.Jobs; using BenchmarkDotNet.Validators; -namespace MQTTnet.Benchmarks +namespace MQTTnet.Benchmarks.Configurations { /// /// this options may be used to run benchmarks in debugmode and attach a performance profiler /// https://benchmarkdotnet.org/Configs/Configs.htm /// - public class AllowNonOptimized : ManualConfig + public class AllowNonOptimized : BaseConfig { public AllowNonOptimized() { 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); } } diff --git a/Tests/MQTTnet.Benchmarks/Configurations/BaseConfig.cs b/Tests/MQTTnet.Benchmarks/Configurations/BaseConfig.cs new file mode 100644 index 00000000..418bb2f3 --- /dev/null +++ b/Tests/MQTTnet.Benchmarks/Configurations/BaseConfig.cs @@ -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 + } + } +} diff --git a/Tests/MQTTnet.Benchmarks/Configurations/RuntimeCompareConfig.cs b/Tests/MQTTnet.Benchmarks/Configurations/RuntimeCompareConfig.cs new file mode 100644 index 00000000..608271e2 --- /dev/null +++ b/Tests/MQTTnet.Benchmarks/Configurations/RuntimeCompareConfig.cs @@ -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)); + } + + } +} diff --git a/Tests/MQTTnet.Benchmarks/Program.cs b/Tests/MQTTnet.Benchmarks/Program.cs index 9407ccfe..280416d3 100644 --- a/Tests/MQTTnet.Benchmarks/Program.cs +++ b/Tests/MQTTnet.Benchmarks/Program.cs @@ -1,5 +1,6 @@ using System; using BenchmarkDotNet.Running; +using MQTTnet.Benchmarks.Configurations; using MQTTnet.Diagnostics; namespace MQTTnet.Benchmarks @@ -43,7 +44,7 @@ namespace MQTTnet.Benchmarks BenchmarkRunner.Run(); break; case '8': - BenchmarkRunner.Run(new AllowNonOptimized()); + BenchmarkRunner.Run(new RuntimeCompareConfig()/*new AllowNonOptimized()*/); break; }