From c15493106a76af53647427054021a992aed88d8c Mon Sep 17 00:00:00 2001 From: Cijo Thomas Date: Mon, 31 Oct 2022 16:16:31 -0400 Subject: [PATCH] Add benchmark numbers and remove invalid case (#3848) --- .../Helper/ActivityCreationScenarios.cs | 12 --------- .../OpenTelemetrySdkBenchmarksActivity.cs | 22 +++++++++++++--- test/Benchmarks/Trace/TraceBenchmarks.cs | 26 +++++++++++++++++++ 3 files changed, 45 insertions(+), 15 deletions(-) diff --git a/test/Benchmarks/Helper/ActivityCreationScenarios.cs b/test/Benchmarks/Helper/ActivityCreationScenarios.cs index b1683e5a063..a9a90318197 100644 --- a/test/Benchmarks/Helper/ActivityCreationScenarios.cs +++ b/test/Benchmarks/Helper/ActivityCreationScenarios.cs @@ -52,17 +52,5 @@ public static void CreateActivityWithAttributes(ActivitySource source) activity?.SetTag("tag3", true); activity?.Stop(); } - - public static void CreateActivityWithAttributesAndCustomProperty(ActivitySource source) - { - using var activity = source.StartActivity("name"); - activity?.SetTag("tag1", "string"); - activity?.SetTag("tag2", 1); - - // use custom property instead of tags - // activity?.SetTag("customPropTag1", "somecustomValue"); - activity?.SetCustomProperty("customPropTag1", "somecustomValue"); - activity?.Stop(); - } } } diff --git a/test/Benchmarks/Trace/OpenTelemetrySdkBenchmarksActivity.cs b/test/Benchmarks/Trace/OpenTelemetrySdkBenchmarksActivity.cs index 47c1b208b71..c0f2e11a338 100644 --- a/test/Benchmarks/Trace/OpenTelemetrySdkBenchmarksActivity.cs +++ b/test/Benchmarks/Trace/OpenTelemetrySdkBenchmarksActivity.cs @@ -20,6 +20,25 @@ using OpenTelemetry; using OpenTelemetry.Trace; +/* +// * Summary * + +BenchmarkDotNet=v0.13.2, OS=Windows 10 (10.0.19044.2130/21H2/November2021Update) +Intel Core i7-4790 CPU 3.60GHz (Haswell), 1 CPU, 8 logical and 4 physical cores +.NET SDK=7.0.100-preview.7.22377.5 + [Host] : .NET 6.0.10 (6.0.1022.47605), X64 RyuJIT AVX2 + DefaultJob : .NET 6.0.10 (6.0.1022.47605), X64 RyuJIT AVX2 + + +| Method | Mean | Error | StdDev | Gen0 | Allocated | +|--------------------------------------------------------- |---------:|--------:|--------:|-------:|----------:| +| CreateActivity_NoopProcessor | 457.9 ns | 1.39 ns | 1.23 ns | 0.0992 | 416 B | +| CreateActivity_WithParentContext_NoopProcessor | 104.8 ns | 0.43 ns | 0.36 ns | - | - | +| CreateActivity_WithParentId_NoopProcessor | 221.9 ns | 0.44 ns | 0.39 ns | 0.0343 | 144 B | +| CreateActivity_WithAttributes_NoopProcessor | 541.4 ns | 3.32 ns | 2.94 ns | 0.1488 | 624 B | +| CreateActiviti_WithKind_NoopProcessor | 437.5 ns | 2.05 ns | 1.92 ns | 0.0992 | 416 B | +*/ + namespace Benchmarks.Trace { public class OpenTelemetrySdkBenchmarksActivity @@ -56,9 +75,6 @@ public void GlobalCleanup() [Benchmark] public void CreateActivity_WithAttributes_NoopProcessor() => ActivityCreationScenarios.CreateActivityWithAttributes(this.benchmarkSource); - [Benchmark] - public void CreateActivity_WithAttributesAndCustomProp_NoopProcessor() => ActivityCreationScenarios.CreateActivityWithAttributesAndCustomProperty(this.benchmarkSource); - [Benchmark] public void CreateActiviti_WithKind_NoopProcessor() => ActivityCreationScenarios.CreateActivityWithKind(this.benchmarkSource); } diff --git a/test/Benchmarks/Trace/TraceBenchmarks.cs b/test/Benchmarks/Trace/TraceBenchmarks.cs index 9ab0a252456..8a7b82b5dd4 100644 --- a/test/Benchmarks/Trace/TraceBenchmarks.cs +++ b/test/Benchmarks/Trace/TraceBenchmarks.cs @@ -19,6 +19,32 @@ using OpenTelemetry; using OpenTelemetry.Trace; +/* +// * Summary * + +BenchmarkDotNet=v0.13.2, OS=Windows 10 (10.0.19044.2130/21H2/November2021Update) +Intel Core i7-4790 CPU 3.60GHz(Haswell), 1 CPU, 8 logical and 4 physical cores +.NET SDK= 7.0.100-preview.7.22377.5 + [Host] : .NET 6.0.10 (6.0.1022.47605), X64 RyuJIT AVX2 + DefaultJob : .NET 6.0.10 (6.0.1022.47605), X64 RyuJIT AVX2 + + +| Method | Mean | Error | StdDev | Gen0 | Allocated | +|--------------------------------- |----------:|---------:|---------:|-------:|----------:| +| NoListener | 20.86 ns | 0.379 ns | 0.336 ns | - | - | +| PropagationDataListner | 376.51 ns | 1.361 ns | 1.273 ns | 0.0992 | 416 B | +| AllDataListner | 377.38 ns | 2.715 ns | 2.407 ns | 0.0992 | 416 B | +| AllDataAndRecordedListner | 375.79 ns | 3.393 ns | 3.008 ns | 0.0992 | 416 B | +| OneProcessor | 432.98 ns | 1.562 ns | 1.461 ns | 0.0992 | 416 B | +| TwoProcessors | 430.16 ns | 2.538 ns | 2.250 ns | 0.0992 | 416 B | +| ThreeProcessors | 427.39 ns | 3.243 ns | 2.875 ns | 0.0992 | 416 B | +| OneInstrumentation | 411.56 ns | 2.310 ns | 2.161 ns | 0.0992 | 416 B | +| TwoInstrumentations | 422.27 ns | 3.304 ns | 2.929 ns | 0.0992 | 416 B | +| LegacyActivity_ExactMatchMode | 726.59 ns | 4.852 ns | 4.301 ns | 0.0992 | 416 B | +| LegacyActivity_WildcardMatchMode | 825.79 ns | 7.846 ns | 6.955 ns | 0.0992 | 416 B | + +*/ + namespace Benchmarks.Trace { public class TraceBenchmarks