Small perf improvement for some TagList implementations#7887
Small perf improvement for some TagList implementations#7887andrewlock merged 3 commits intomasterfrom
TagList implementations#7887Conversation
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (7887) and master. ✅ No regressions detected - check the details below Full Metrics ComparisonFakeDbCommand
HttpMessageHandler
Comparison explanationExecution-time benchmarks measure the whole time it takes to execute a program, and are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are highlighted in **red**. The following thresholds were used for comparing the execution times:
Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard. Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph). Duration chartsFakeDbCommand (.NET Framework 4.8)gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7887) - mean (75ms) : 70, 81
master - mean (75ms) : 70, 81
section Bailout
This PR (7887) - mean (80ms) : 74, 87
master - mean (80ms) : 75, 85
section CallTarget+Inlining+NGEN
This PR (7887) - mean (1,077ms) : 1010, 1145
master - mean (1,065ms) : 1004, 1126
FakeDbCommand (.NET Core 3.1)gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7887) - mean (117ms) : 112, 122
master - mean (116ms) : 109, 123
section Bailout
This PR (7887) - mean (119ms) : 113, 124
master - mean (118ms) : 112, 124
section CallTarget+Inlining+NGEN
This PR (7887) - mean (766ms) : 721, 810
master - mean (763ms) : 721, 806
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7887) - mean (104ms) : 96, 112
master - mean (103ms) : 96, 109
section Bailout
This PR (7887) - mean (104ms) : 98, 110
master - mean (103ms) : 97, 110
section CallTarget+Inlining+NGEN
This PR (7887) - mean (707ms) : 677, 737
master - mean (702ms) : 669, 736
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7887) - mean (102ms) : 96, 109
master - mean (103ms) : 95, 110
section Bailout
This PR (7887) - mean (103ms) : 98, 107
master - mean (103ms) : 98, 107
section CallTarget+Inlining+NGEN
This PR (7887) - mean (676ms) : 645, 707
master - mean (667ms) : 639, 695
HttpMessageHandler (.NET Framework 4.8)gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7887) - mean (196ms) : 190, 202
master - mean (195ms) : 191, 200
section Bailout
This PR (7887) - mean (198ms) : 195, 201
master - mean (199ms) : 193, 205
section CallTarget+Inlining+NGEN
This PR (7887) - mean (1,125ms) : 1066, 1184
master - mean (1,131ms) : 1065, 1198
HttpMessageHandler (.NET Core 3.1)gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7887) - mean (280ms) : 271, 290
master - mean (279ms) : 273, 285
section Bailout
This PR (7887) - mean (280ms) : 274, 286
master - mean (280ms) : 275, 286
section CallTarget+Inlining+NGEN
This PR (7887) - mean (916ms) : 867, 966
master - mean (916ms) : 876, 956
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7887) - mean (273ms) : 265, 281
master - mean (275ms) : 268, 281
section Bailout
This PR (7887) - mean (275ms) : 268, 281
master - mean (273ms) : 267, 279
section CallTarget+Inlining+NGEN
This PR (7887) - mean (892ms) : 851, 934
master - mean (898ms) : 846, 949
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7887) - mean (272ms) : 264, 279
master - mean (271ms) : 265, 277
section Bailout
This PR (7887) - mean (272ms) : 266, 279
master - mean (272ms) : 266, 277
section CallTarget+Inlining+NGEN
This PR (7887) - mean (833ms) : 809, 857
master - mean (831ms) : 799, 862
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tags.MessagingDestinationName = entityPath; | ||
| tags.MessagingOperation = operationName; | ||
| tags.MessagingSystem = "servicebus"; | ||
| tags.InstrumentationName = "AzureServiceBus"; |
There was a problem hiding this comment.
I thought there was a reason why this writable but seems fine to me
| @@ -126,7 +126,6 @@ private static CallTargetState CreateSenderSpanInternal( | |||
| tags.MessagingDestinationName = entityPath; | |||
| tags.MessagingOperation = operationName; | |||
| tags.MessagingSystem = "servicebus"; | |||
There was a problem hiding this comment.
Probably more than you wanted to do this PR, but I was looking into why we can't do the same with MessagingSystem, and noticed that AzureServiceBusTags inherits that property from OpenTelemetryTags, but I don't think AzureServiceBusTags needs to inherit from OpenTelemetryTags anymore now that the Service Bus integration uses call-target instrumentation instead of the OpenTelemetry observer.
Maybe something @pablomartinezbernardo can look into later.
There was a problem hiding this comment.
Yeah, I was going to take a look at this, but given our lack of extensive ServiceBus testing, I was a little hesitant, so will move to a separate PR
There was a problem hiding this comment.
Actually, as far as I can tell, we still have an OpenTelemetry observer? 🤔
There was a problem hiding this comment.
I don't know if we still use the observer. Question for Pablo 😅
9e1a8c4 to
988ac78
Compare
|
BenchmarksBenchmarks Report for benchmark platform 🐌Benchmarks for #7887 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Fewer allocations 🎉
|
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 | 3.33 KB | 3.26 KB | -64 B | -1.92% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | WriteAndFlushEnrichedTraces |
net6.0 | 1.26ms | 82.7ns | 287ns | 0 | 0 | 0 | 2.7 KB |
| master | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 1.39ms | 153ns | 593ns | 0 | 0 | 0 | 2.7 KB |
| master | WriteAndFlushEnrichedTraces |
net472 | 1.72ms | 266ns | 958ns | 0 | 0 | 0 | 3.33 KB |
| #7887 | WriteAndFlushEnrichedTraces |
net6.0 | 1.26ms | 161ns | 624ns | 0 | 0 | 0 | 2.7 KB |
| #7887 | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 1.43ms | 1.15μs | 4.44μs | 0 | 0 | 0 | 2.7 KB |
| #7887 | WriteAndFlushEnrichedTraces |
net472 | 1.75ms | 146ns | 564ns | 0 | 0 | 0 | 3.26 KB |
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | AllCycleSimpleBody |
net6.0 | 1.09μs | 6.04ns | 37.7ns | 0 | 0 | 0 | 1.22 KB |
| master | AllCycleSimpleBody |
netcoreapp3.1 | 1.38μs | 7.58ns | 45.5ns | 0 | 0 | 0 | 1.2 KB |
| master | AllCycleSimpleBody |
net472 | 1.02μs | 1.03ns | 3.99ns | 0.192 | 0 | 0 | 1.23 KB |
| master | AllCycleMoreComplexBody |
net6.0 | 7.34μs | 38.8ns | 212ns | 0 | 0 | 0 | 4.72 KB |
| master | AllCycleMoreComplexBody |
netcoreapp3.1 | 8.95μs | 43.9ns | 191ns | 0 | 0 | 0 | 4.62 KB |
| master | AllCycleMoreComplexBody |
net472 | 7.61μs | 5.39ns | 20.9ns | 0.723 | 0 | 0 | 4.74 KB |
| master | ObjectExtractorSimpleBody |
net6.0 | 345ns | 0.101ns | 0.379ns | 0 | 0 | 0 | 280 B |
| master | ObjectExtractorSimpleBody |
netcoreapp3.1 | 400ns | 1.84ns | 7.35ns | 0 | 0 | 0 | 272 B |
| master | ObjectExtractorSimpleBody |
net472 | 307ns | 0.0376ns | 0.146ns | 0.0433 | 0 | 0 | 281 B |
| master | ObjectExtractorMoreComplexBody |
net6.0 | 6.44μs | 31.9ns | 132ns | 0 | 0 | 0 | 3.78 KB |
| master | ObjectExtractorMoreComplexBody |
netcoreapp3.1 | 7.91μs | 39.4ns | 172ns | 0 | 0 | 0 | 3.69 KB |
| master | ObjectExtractorMoreComplexBody |
net472 | 6.69μs | 1.83ns | 6.83ns | 0.571 | 0 | 0 | 3.8 KB |
| #7887 | AllCycleSimpleBody |
net6.0 | 1.11μs | 0.405ns | 1.52ns | 0 | 0 | 0 | 1.22 KB |
| #7887 | AllCycleSimpleBody |
netcoreapp3.1 | 1.39μs | 7.92ns | 56.6ns | 0 | 0 | 0 | 1.2 KB |
| #7887 | AllCycleSimpleBody |
net472 | 1.01μs | 0.933ns | 3.61ns | 0.192 | 0 | 0 | 1.23 KB |
| #7887 | AllCycleMoreComplexBody |
net6.0 | 7.36μs | 34.3ns | 137ns | 0 | 0 | 0 | 4.72 KB |
| #7887 | AllCycleMoreComplexBody |
netcoreapp3.1 | 9.03μs | 42.3ns | 169ns | 0 | 0 | 0 | 4.62 KB |
| #7887 | AllCycleMoreComplexBody |
net472 | 7.64μs | 3.26ns | 11.7ns | 0.725 | 0 | 0 | 4.74 KB |
| #7887 | ObjectExtractorSimpleBody |
net6.0 | 333ns | 1.62ns | 7.95ns | 0 | 0 | 0 | 280 B |
| #7887 | ObjectExtractorSimpleBody |
netcoreapp3.1 | 396ns | 2.24ns | 14.9ns | 0 | 0 | 0 | 272 B |
| #7887 | ObjectExtractorSimpleBody |
net472 | 312ns | 0.122ns | 0.471ns | 0.0439 | 0 | 0 | 281 B |
| #7887 | ObjectExtractorMoreComplexBody |
net6.0 | 6.38μs | 32ns | 147ns | 0 | 0 | 0 | 3.79 KB |
| #7887 | ObjectExtractorMoreComplexBody |
netcoreapp3.1 | 7.78μs | 39.2ns | 180ns | 0 | 0 | 0 | 3.69 KB |
| #7887 | ObjectExtractorMoreComplexBody |
net472 | 6.7μs | 4.19ns | 16.2ns | 0.603 | 0 | 0 | 3.8 KB |
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EncodeArgs |
net6.0 | 76.4μs | 17.5ns | 67.7ns | 0 | 0 | 0 | 32.4 KB |
| master | EncodeArgs |
netcoreapp3.1 | 97.1μs | 311ns | 1.21μs | 0 | 0 | 0 | 32.4 KB |
| master | EncodeArgs |
net472 | 109μs | 12.9ns | 50ns | 4.89 | 0 | 0 | 32.5 KB |
| master | EncodeLegacyArgs |
net6.0 | 146μs | 17.2ns | 64.2ns | 0 | 0 | 0 | 2.14 KB |
| master | EncodeLegacyArgs |
netcoreapp3.1 | 200μs | 83.3ns | 323ns | 0 | 0 | 0 | 2.14 KB |
| master | EncodeLegacyArgs |
net472 | 264μs | 21.2ns | 82ns | 0 | 0 | 0 | 2.14 KB |
| #7887 | EncodeArgs |
net6.0 | 75.3μs | 43.2ns | 150ns | 0 | 0 | 0 | 32.4 KB |
| #7887 | EncodeArgs |
netcoreapp3.1 | 97.6μs | 214ns | 831ns | 0 | 0 | 0 | 32.4 KB |
| #7887 | EncodeArgs |
net472 | 109μs | 13.5ns | 52.4ns | 4.88 | 0 | 0 | 32.5 KB |
| #7887 | EncodeLegacyArgs |
net6.0 | 148μs | 10.4ns | 36.1ns | 0 | 0 | 0 | 2.14 KB |
| #7887 | EncodeLegacyArgs |
netcoreapp3.1 | 198μs | 40.1ns | 139ns | 0 | 0 | 0 | 2.14 KB |
| #7887 | EncodeLegacyArgs |
net472 | 264μs | 20.9ns | 75.2ns | 0 | 0 | 0 | 2.14 KB |
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | RunWafRealisticBenchmark |
net6.0 | 415μs | 1.11μs | 4.15μs | 0 | 0 | 0 | 4.55 KB |
| master | RunWafRealisticBenchmark |
netcoreapp3.1 | 472μs | 3.6μs | 34.5μs | 0 | 0 | 0 | 4.48 KB |
| master | RunWafRealisticBenchmark |
net472 | 496μs | 427ns | 1.6μs | 0 | 0 | 0 | 0 b |
| master | RunWafRealisticBenchmarkWithAttack |
net6.0 | 306μs | 1.27μs | 4.58μs | 0 | 0 | 0 | 2.24 KB |
| master | RunWafRealisticBenchmarkWithAttack |
netcoreapp3.1 | 353μs | 3.58μs | 35μs | 0 | 0 | 0 | 2.22 KB |
| master | RunWafRealisticBenchmarkWithAttack |
net472 | 364μs | 233ns | 841ns | 0 | 0 | 0 | 0 b |
| #7887 | RunWafRealisticBenchmark |
net6.0 | 420μs | 629ns | 2.27μs | 0 | 0 | 0 | 4.55 KB |
| #7887 | RunWafRealisticBenchmark |
netcoreapp3.1 | 456μs | 3.67μs | 34.8μs | 0 | 0 | 0 | 4.48 KB |
| #7887 | RunWafRealisticBenchmark |
net472 | 491μs | 565ns | 2.19μs | 0 | 0 | 0 | 0 b |
| #7887 | RunWafRealisticBenchmarkWithAttack |
net6.0 | 308μs | 880ns | 3.17μs | 0 | 0 | 0 | 2.24 KB |
| #7887 | RunWafRealisticBenchmarkWithAttack |
netcoreapp3.1 | 342μs | 2.95μs | 27.8μs | 0 | 0 | 0 | 2.22 KB |
| #7887 | RunWafRealisticBenchmarkWithAttack |
net472 | 366μs | 430ns | 1.49μs | 0 | 0 | 0 | 0 b |
Benchmarks.Trace.AspNetCoreBenchmark - Unknown 🤷 More allocations ⚠️
More allocations ⚠️ in #7887
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.AspNetCoreBenchmark.SendRequest‑netcoreapp3.1
21.18 KB
21.3 KB
116 B
0.55%
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.AspNetCoreBenchmark.SendRequest‑netcoreapp3.1 | 21.18 KB | 21.3 KB | 116 B | 0.55% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendRequest |
net6.0 | 85μs | 91.8ns | 343ns | 0 | 0 | 0 | 18.97 KB |
| master | SendRequest |
netcoreapp3.1 | 95.4μs | 84.8ns | 317ns | 0 | 0 | 0 | 21.18 KB |
| master | SendRequest |
net472 | 0ns | 0ns | 0ns | 0 | 0 | 0 | 0 b |
| #7887 | SendRequest |
net6.0 | 84.3μs | 223ns | 1.24μs | 0 | 0 | 0 | 18.98 KB |
| #7887 | SendRequest |
netcoreapp3.1 | 97.2μs | 266ns | 1.62μs | 0 | 0 | 0 | 21.3 KB |
| #7887 | SendRequest |
net472 | 0ns | 0ns | 0ns | 0 | 0 | 0 | 0 b |
Benchmarks.Trace.CharSliceBenchmark - Slower ⚠️ Same allocations ✔️
Slower ⚠️ in #7887
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0
1.128
1,014,050.00
1,144,200.00
| Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0 | 1.128 | 1,014,050.00 | 1,144,200.00 |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | OriginalCharSlice |
net6.0 | 1.9ms | 1.79μs | 6.69μs | 0 | 0 | 0 | 640 KB |
| master | OriginalCharSlice |
netcoreapp3.1 | 3.86ms | 897ns | 3.47μs | 0 | 0 | 0 | 640.05 KB |
| master | OriginalCharSlice |
net472 | 2.67ms | 578ns | 2.08μs | 0 | 0 | 0 | 638.98 KB |
| master | OptimizedCharSlice |
net6.0 | 1.51ms | 1.81μs | 6.99μs | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSlice |
netcoreapp3.1 | 2.88ms | 307ns | 1.06μs | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSlice |
net472 | 1.9ms | 715ns | 2.77μs | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSliceWithPool |
net6.0 | 1.01ms | 732ns | 2.74μs | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSliceWithPool |
netcoreapp3.1 | 1.86ms | 1.06μs | 3.96μs | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSliceWithPool |
net472 | 1.14ms | 463ns | 1.79μs | 0 | 0 | 0 | 0 b |
| #7887 | OriginalCharSlice |
net6.0 | 1.95ms | 953ns | 3.69μs | 0 | 0 | 0 | 640 KB |
| #7887 | OriginalCharSlice |
netcoreapp3.1 | 3.88ms | 1.43μs | 5.14μs | 0 | 0 | 0 | 640.05 KB |
| #7887 | OriginalCharSlice |
net472 | 2.65ms | 590ns | 2.21μs | 0 | 0 | 0 | 638.98 KB |
| #7887 | OptimizedCharSlice |
net6.0 | 1.48ms | 419ns | 1.57μs | 0 | 0 | 0 | 0 b |
| #7887 | OptimizedCharSlice |
netcoreapp3.1 | 2.73ms | 531ns | 2.06μs | 0 | 0 | 0 | 0 b |
| #7887 | OptimizedCharSlice |
net472 | 2.07ms | 782ns | 2.82μs | 0 | 0 | 0 | 0 b |
| #7887 | OptimizedCharSliceWithPool |
net6.0 | 1.15ms | 1.53μs | 5.92μs | 0 | 0 | 0 | 0 b |
| #7887 | OptimizedCharSliceWithPool |
netcoreapp3.1 | 1.89ms | 1.98μs | 7.65μs | 0 | 0 | 0 | 0 b |
| #7887 | OptimizedCharSliceWithPool |
net472 | 1.13ms | 340ns | 1.27μs | 0 | 0 | 0 | 0 b |
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Fewer allocations 🎉
Fewer allocations 🎉 in #7887
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1
41.97 KB
41.76 KB
-210 B
-0.50%
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 | 41.97 KB | 41.76 KB | -210 B | -0.50% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | WriteAndFlushEnrichedTraces |
net6.0 | 775μs | 4.34μs | 28.8μs | 0 | 0 | 0 | 41.91 KB |
| master | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 667μs | 2.52μs | 9.41μs | 0 | 0 | 0 | 41.97 KB |
| master | WriteAndFlushEnrichedTraces |
net472 | 984μs | 4.55μs | 17.6μs | 4.81 | 0 | 0 | 56.02 KB |
| #7887 | WriteAndFlushEnrichedTraces |
net6.0 | 719μs | 1.83μs | 7.1μs | 0 | 0 | 0 | 41.8 KB |
| #7887 | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 709μs | 1.05μs | 3.92μs | 0 | 0 | 0 | 41.76 KB |
| #7887 | WriteAndFlushEnrichedTraces |
net472 | 878μs | 2.82μs | 10.9μs | 8.33 | 4.17 | 0 | 56.15 KB |
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | ExecuteNonQuery |
net6.0 | 1.86μs | 7.66ns | 29.7ns | 0 | 0 | 0 | 968 B |
| master | ExecuteNonQuery |
netcoreapp3.1 | 2.64μs | 6.1ns | 23.6ns | 0 | 0 | 0 | 960 B |
| master | ExecuteNonQuery |
net472 | 2.74μs | 2ns | 7.74ns | 0.135 | 0 | 0 | 931 B |
| #7887 | ExecuteNonQuery |
net6.0 | 1.95μs | 9.77ns | 43.7ns | 0 | 0 | 0 | 968 B |
| #7887 | ExecuteNonQuery |
netcoreapp3.1 | 2.51μs | 10.8ns | 40.3ns | 0 | 0 | 0 | 960 B |
| #7887 | ExecuteNonQuery |
net472 | 2.7μs | 2.3ns | 8.61ns | 0.136 | 0 | 0 | 931 B |
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | CallElasticsearch |
net6.0 | 1.75μs | 3.64ns | 14.1ns | 0 | 0 | 0 | 952 B |
| master | CallElasticsearch |
netcoreapp3.1 | 2.21μs | 4.71ns | 18.2ns | 0 | 0 | 0 | 968 B |
| master | CallElasticsearch |
net472 | 3.31μs | 2.48ns | 9.61ns | 0.147 | 0 | 0 | 955 B |
| master | CallElasticsearchAsync |
net6.0 | 1.72μs | 0.562ns | 1.95ns | 0 | 0 | 0 | 928 B |
| master | CallElasticsearchAsync |
netcoreapp3.1 | 2.34μs | 11.6ns | 47.8ns | 0 | 0 | 0 | 1.02 KB |
| master | CallElasticsearchAsync |
net472 | 3.48μs | 0.818ns | 3.06ns | 0.157 | 0 | 0 | 1.01 KB |
| #7887 | CallElasticsearch |
net6.0 | 1.77μs | 0.668ns | 2.32ns | 0 | 0 | 0 | 952 B |
| #7887 | CallElasticsearch |
netcoreapp3.1 | 2.09μs | 6.58ns | 25.5ns | 0 | 0 | 0 | 968 B |
| #7887 | CallElasticsearch |
net472 | 3.35μs | 4.62ns | 17.9ns | 0.151 | 0 | 0 | 955 B |
| #7887 | CallElasticsearchAsync |
net6.0 | 1.7μs | 8.16ns | 34.6ns | 0 | 0 | 0 | 928 B |
| #7887 | CallElasticsearchAsync |
netcoreapp3.1 | 2.37μs | 6.44ns | 23.2ns | 0 | 0 | 0 | 1.02 KB |
| #7887 | CallElasticsearchAsync |
net472 | 3.5μs | 2.86ns | 11.1ns | 0.158 | 0 | 0 | 1.01 KB |
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | ExecuteAsync |
net6.0 | 1.88μs | 8.19ns | 31.7ns | 0 | 0 | 0 | 896 B |
| master | ExecuteAsync |
netcoreapp3.1 | 2.42μs | 4.12ns | 15.4ns | 0 | 0 | 0 | 896 B |
| master | ExecuteAsync |
net472 | 2.51μs | 1.34ns | 5.18ns | 0.125 | 0 | 0 | 859 B |
| #7887 | ExecuteAsync |
net6.0 | 1.78μs | 6.18ns | 23.9ns | 0 | 0 | 0 | 896 B |
| #7887 | ExecuteAsync |
netcoreapp3.1 | 2.4μs | 8.05ns | 29ns | 0 | 0 | 0 | 896 B |
| #7887 | ExecuteAsync |
net472 | 2.56μs | 1.09ns | 4.23ns | 0.127 | 0 | 0 | 858 B |
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendAsync |
net6.0 | 6.78μs | 17ns | 61.4ns | 0 | 0 | 0 | 2.29 KB |
| master | SendAsync |
netcoreapp3.1 | 8.63μs | 33.1ns | 128ns | 0 | 0 | 0 | 2.83 KB |
| master | SendAsync |
net472 | 11.9μs | 11.2ns | 43.4ns | 0.473 | 0 | 0 | 3.08 KB |
| #7887 | SendAsync |
net6.0 | 6.61μs | 12.4ns | 47.9ns | 0 | 0 | 0 | 2.29 KB |
| #7887 | SendAsync |
netcoreapp3.1 | 8.51μs | 18.7ns | 72.3ns | 0 | 0 | 0 | 2.83 KB |
| #7887 | SendAsync |
net472 | 11.9μs | 9.42ns | 36.5ns | 0.472 | 0 | 0 | 3.08 KB |
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ More allocations ⚠️
More allocations ⚠️ in #7887
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1
277.01 KB
280.5 KB
3.49 KB
1.26%
Fewer allocations 🎉 in #7887
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472
273.92 KB
270.34 KB
-3.58 KB
-1.31%
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 | 277.01 KB | 280.5 KB | 3.49 KB | 1.26% |
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472 | 273.92 KB | 270.34 KB | -3.58 KB | -1.31% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StringConcatBenchmark |
net6.0 | 45.8μs | 270ns | 2.51μs | 0 | 0 | 0 | 42.51 KB |
| master | StringConcatBenchmark |
netcoreapp3.1 | 50.8μs | 267ns | 1.96μs | 0 | 0 | 0 | 42.54 KB |
| master | StringConcatBenchmark |
net472 | 57.6μs | 123ns | 444ns | 0 | 0 | 0 | 49.15 KB |
| master | StringConcatAspectBenchmark |
net6.0 | 528μs | 2.13μs | 7.38μs | 0 | 0 | 0 | 273.98 KB |
| master | StringConcatAspectBenchmark |
netcoreapp3.1 | 461μs | 5.84μs | 57.2μs | 0 | 0 | 0 | 277.01 KB |
| master | StringConcatAspectBenchmark |
net472 | 404μs | 2.17μs | 17.1μs | 0 | 0 | 0 | 273.92 KB |
| #7887 | StringConcatBenchmark |
net6.0 | 43.6μs | 245ns | 1.49μs | 0 | 0 | 0 | 42.51 KB |
| #7887 | StringConcatBenchmark |
netcoreapp3.1 | 49.8μs | 266ns | 1.79μs | 0 | 0 | 0 | 42.54 KB |
| #7887 | StringConcatBenchmark |
net472 | 58μs | 136ns | 471ns | 0 | 0 | 0 | 49.15 KB |
| #7887 | StringConcatAspectBenchmark |
net6.0 | 487μs | 2.5μs | 12μs | 0 | 0 | 0 | 273.88 KB |
| #7887 | StringConcatAspectBenchmark |
netcoreapp3.1 | 540μs | 1.97μs | 6.83μs | 0 | 0 | 0 | 280.5 KB |
| #7887 | StringConcatAspectBenchmark |
net472 | 391μs | 1.6μs | 5.77μs | 0 | 0 | 0 | 270.34 KB |
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net6.0 | 2.66μs | 13.6ns | 51ns | 0 | 0 | 0 | 1.69 KB |
| master | EnrichedLog |
netcoreapp3.1 | 3.57μs | 17ns | 67.9ns | 0 | 0 | 0 | 1.7 KB |
| master | EnrichedLog |
net472 | 3.86μs | 5.22ns | 20.2ns | 0.252 | 0 | 0 | 1.6 KB |
| #7887 | EnrichedLog |
net6.0 | 2.7μs | 12.7ns | 50.8ns | 0 | 0 | 0 | 1.69 KB |
| #7887 | EnrichedLog |
netcoreapp3.1 | 3.51μs | 14.2ns | 55.2ns | 0 | 0 | 0 | 1.7 KB |
| #7887 | EnrichedLog |
net472 | 4μs | 3.2ns | 12.4ns | 0.242 | 0 | 0 | 1.6 KB |
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net6.0 | 122μs | 118ns | 456ns | 0 | 0 | 0 | 4.31 KB |
| master | EnrichedLog |
netcoreapp3.1 | 127μs | 155ns | 538ns | 0 | 0 | 0 | 4.31 KB |
| master | EnrichedLog |
net472 | 167μs | 115ns | 432ns | 0 | 0 | 0 | 4.51 KB |
| #7887 | EnrichedLog |
net6.0 | 123μs | 75.3ns | 271ns | 0 | 0 | 0 | 4.31 KB |
| #7887 | EnrichedLog |
netcoreapp3.1 | 129μs | 236ns | 913ns | 0 | 0 | 0 | 4.31 KB |
| #7887 | EnrichedLog |
net472 | 170μs | 107ns | 387ns | 0 | 0 | 0 | 4.51 KB |
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net6.0 | 5.13μs | 6.42ns | 24.9ns | 0 | 0 | 0 | 2.24 KB |
| master | EnrichedLog |
netcoreapp3.1 | 6.93μs | 24.4ns | 94.6ns | 0 | 0 | 0 | 2.26 KB |
| master | EnrichedLog |
net472 | 7.57μs | 9.37ns | 36.3ns | 0.302 | 0 | 0 | 2.05 KB |
| #7887 | EnrichedLog |
net6.0 | 5.11μs | 2.93ns | 11.3ns | 0 | 0 | 0 | 2.24 KB |
| #7887 | EnrichedLog |
netcoreapp3.1 | 6.86μs | 28.8ns | 111ns | 0 | 0 | 0 | 2.26 KB |
| #7887 | EnrichedLog |
net472 | 7.56μs | 4.82ns | 18ns | 0.302 | 0 | 0 | 2.05 KB |
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendReceive |
net6.0 | 1.96μs | 10.1ns | 49.4ns | 0 | 0 | 0 | 1.12 KB |
| master | SendReceive |
netcoreapp3.1 | 2.55μs | 8ns | 31ns | 0 | 0 | 0 | 1.14 KB |
| master | SendReceive |
net472 | 2.96μs | 3.57ns | 13.8ns | 0.165 | 0 | 0 | 1.12 KB |
| #7887 | SendReceive |
net6.0 | 1.92μs | 0.609ns | 2.36ns | 0 | 0 | 0 | 1.12 KB |
| #7887 | SendReceive |
netcoreapp3.1 | 2.47μs | 8.24ns | 31.9ns | 0 | 0 | 0 | 1.14 KB |
| #7887 | SendReceive |
net472 | 2.95μs | 1.81ns | 6.78ns | 0.163 | 0 | 0 | 1.12 KB |
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net6.0 | 4.31μs | 1.93ns | 6.69ns | 0 | 0 | 0 | 1.58 KB |
| master | EnrichedLog |
netcoreapp3.1 | 5.98μs | 11.4ns | 44.1ns | 0 | 0 | 0 | 1.63 KB |
| master | EnrichedLog |
net472 | 6.76μs | 7.07ns | 27.4ns | 0.305 | 0 | 0 | 2.03 KB |
| #7887 | EnrichedLog |
net6.0 | 4.48μs | 13.1ns | 50.8ns | 0 | 0 | 0 | 1.58 KB |
| #7887 | EnrichedLog |
netcoreapp3.1 | 5.84μs | 14.5ns | 54.2ns | 0 | 0 | 0 | 1.63 KB |
| #7887 | EnrichedLog |
net472 | 6.69μs | 8.64ns | 33.4ns | 0.3 | 0 | 0 | 2.03 KB |
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StartFinishSpan |
net6.0 | 762ns | 0.214ns | 0.802ns | 0 | 0 | 0 | 520 B |
| master | StartFinishSpan |
netcoreapp3.1 | 948ns | 5ns | 26ns | 0 | 0 | 0 | 520 B |
| master | StartFinishSpan |
net472 | 885ns | 0.0526ns | 0.197ns | 0.0798 | 0 | 0 | 522 B |
| master | StartFinishScope |
net6.0 | 895ns | 4.33ns | 17.8ns | 0 | 0 | 0 | 640 B |
| master | StartFinishScope |
netcoreapp3.1 | 1.14μs | 2.01ns | 7.8ns | 0 | 0 | 0 | 640 B |
| master | StartFinishScope |
net472 | 1.07μs | 0.203ns | 0.787ns | 0.091 | 0 | 0 | 602 B |
| master | StartFinishTwoScopes |
net6.0 | 1.76μs | 0.426ns | 1.54ns | 0 | 0 | 0 | 1.19 KB |
| master | StartFinishTwoScopes |
netcoreapp3.1 | 2.2μs | 11.3ns | 50.4ns | 0 | 0 | 0 | 1.19 KB |
| master | StartFinishTwoScopes |
net472 | 2.12μs | 0.826ns | 3.2ns | 0.17 | 0 | 0 | 1.08 KB |
| #7887 | StartFinishSpan |
net6.0 | 784ns | 3.25ns | 12.6ns | 0 | 0 | 0 | 520 B |
| #7887 | StartFinishSpan |
netcoreapp3.1 | 946ns | 5.03ns | 25.1ns | 0 | 0 | 0 | 520 B |
| #7887 | StartFinishSpan |
net472 | 889ns | 0.0826ns | 0.32ns | 0.0802 | 0 | 0 | 522 B |
| #7887 | StartFinishScope |
net6.0 | 915ns | 4.46ns | 18.9ns | 0 | 0 | 0 | 640 B |
| #7887 | StartFinishScope |
netcoreapp3.1 | 1.15μs | 5.15ns | 19.3ns | 0 | 0 | 0 | 640 B |
| #7887 | StartFinishScope |
net472 | 1.07μs | 0.264ns | 0.952ns | 0.0909 | 0 | 0 | 602 B |
| #7887 | StartFinishTwoScopes |
net6.0 | 1.78μs | 8.6ns | 35.5ns | 0 | 0 | 0 | 1.19 KB |
| #7887 | StartFinishTwoScopes |
netcoreapp3.1 | 2.24μs | 11.3ns | 50.6ns | 0 | 0 | 0 | 1.19 KB |
| #7887 | StartFinishTwoScopes |
net472 | 2.11μs | 0.59ns | 2.13ns | 0.168 | 0 | 0 | 1.08 KB |
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | RunOnMethodBegin |
net6.0 | 1.06μs | 0.55ns | 2.13ns | 0 | 0 | 0 | 640 B |
| master | RunOnMethodBegin |
netcoreapp3.1 | 1.37μs | 6.78ns | 28.8ns | 0 | 0 | 0 | 640 B |
| master | RunOnMethodBegin |
net472 | 1.38μs | 0.741ns | 2.77ns | 0.0896 | 0 | 0 | 602 B |
| #7887 | RunOnMethodBegin |
net6.0 | 1.1μs | 5.4ns | 23.6ns | 0 | 0 | 0 | 640 B |
| #7887 | RunOnMethodBegin |
netcoreapp3.1 | 1.32μs | 0.761ns | 2.95ns | 0 | 0 | 0 | 640 B |
| #7887 | RunOnMethodBegin |
net472 | 1.39μs | 0.66ns | 2.55ns | 0.09 | 0 | 0 | 602 B |
Summary of changes
Tags that are readonly should be implemented as such, and return a value directly
Reason for change
We have some tags that currently always return the same value, but are implemented as writeable fields. This requires a backing field, and so means the object is sliiiightly more allocatey than it needs to be.
Implementation details
Switch to using
=>readonly properties instead of{ get; set; }Test coverage
If the tests pass, it's fine