Skip to content

Commit

Permalink
Add benchmark numbers and remove invalid case (#3848)
Browse files Browse the repository at this point in the history
  • Loading branch information
cijothomas authored Oct 31, 2022
1 parent 131b350 commit c154931
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 15 deletions.
12 changes: 0 additions & 12 deletions test/Benchmarks/Helper/ActivityCreationScenarios.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
22 changes: 19 additions & 3 deletions test/Benchmarks/Trace/OpenTelemetrySdkBenchmarksActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
Expand Down
26 changes: 26 additions & 0 deletions test/Benchmarks/Trace/TraceBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c154931

Please sign in to comment.