Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dynamic Instrumentation] Reduce allocations in probe processing #5132

Merged
merged 3 commits into from
Apr 4, 2024

Conversation

dudikeleti
Copy link
Contributor

Summary of changes

Avoid creating unnecessary objects via lambda expression (where clause) and minimize the number of array allocations when processing probes.

Reason for change

Probes are critical path because they are part of the customer code so we want to make it thin as possible.

Implementation details

Using array pool for saving method scope members.

Test coverage

All probes integration tests.

@dudikeleti dudikeleti requested review from a team as code owners February 1, 2024 08:08
@github-actions github-actions bot added area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) area:debugger labels Feb 1, 2024
@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Feb 1, 2024

Datadog Report

Branch report: dudik/reduce-allocations-in-probes
Commit report: 50c63a0
Test service: dd-trace-dotnet

❌ 546 Failed (0 Known Flaky), 272786 Passed, 1858 Skipped, 55m 34.1s Wall Time

❌ Failed Tests (546)

This report shows up to 5 failed tests.

  • MethodProbeTest - Datadog.Trace.Debugger.IntegrationTests.ProbesTests - Details

    Expand for error
     Results do not match.
     Differences:
     Received: ProbeTests.SpanDecorationTwoSegmentsWithError.with.dynamic.span.received.txt
     Verified: ProbeTests.SpanDecorationTwoSegmentsWithError.with.dynamic.span.verified.txt
     Received Content:
     [
       {
         TraceId: Id_1,
         SpanId: Id_2,
         Name: dd.dynamic.span,
     ...
    
  • MethodProbeTest - Datadog.Trace.Debugger.IntegrationTests.ProbesTests - Details

    Expand for error
     Results do not match.
     Differences:
     Received: ProbeTests.SpanDecorationWithoutWhen.with.dynamic.span.received.txt
     Verified: ProbeTests.SpanDecorationWithoutWhen.with.dynamic.span.verified.txt
     Received Content:
     [
       {
         TraceId: Id_1,
         SpanId: Id_2,
         Name: dd.dynamic.span,
     ...
    
  • MethodProbeTest - Datadog.Trace.Debugger.IntegrationTests.ProbesTests - Details

    Expand for error
     Results do not match.
     Differences:
     Received: ProbeTests.SpanDecorationArgsAndLocals.with.dynamic.span.received.txt
     Verified: ProbeTests.SpanDecorationArgsAndLocals.with.dynamic.span.verified.txt
     Received Content:
     [
       {
         TraceId: Id_1,
         SpanId: Id_2,
         Name: dd.dynamic.span,
     ...
    
  • MethodProbeTest - Datadog.Trace.Debugger.IntegrationTests.ProbesTests - Details

    Expand for error
     Results do not match.
     Differences:
     Received: ProbeTests.SpanDecorationTwoTags.with.dynamic.span.received.txt
     Verified: ProbeTests.SpanDecorationTwoTags.with.dynamic.span.verified.txt
     Received Content:
     [
       {
         TraceId: Id_1,
         SpanId: Id_2,
         Name: dd.dynamic.span,
     ...
    
  • MethodProbeTest - Datadog.Trace.Debugger.IntegrationTests.ProbesTests - Details

    Expand for error
     Results do not match.
     Differences:
     Received: ProbeTests.SpanDecorationError.with.dynamic.span.received.txt
     Verified: ProbeTests.SpanDecorationError.with.dynamic.span.verified.txt
     Received Content:
     [
       {
         TraceId: Id_1,
         SpanId: Id_2,
         Name: dd.dynamic.span,
     ...
    

@andrewlock
Copy link
Member

andrewlock commented Feb 1, 2024

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing the following branches/commits:

Execution-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 shown in red. The following thresholds were used for comparing the execution times:

  • Welch test with statistical test for significance of 5%
  • Only results indicating a difference greater than 5% and 5 ms are considered.

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).

gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5132) - mean (76ms)  : 66, 85
     .   : milestone, 76,
    master - mean (73ms)  : 67, 79
     .   : milestone, 73,

    section CallTarget+Inlining+NGEN
    This PR (5132) - mean (1,012ms)  : 988, 1037
     .   : milestone, 1012,
    master - mean (1,005ms)  : 987, 1024
     .   : milestone, 1005,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5132) - mean (112ms)  : 107, 116
     .   : milestone, 112,
    master - mean (110ms)  : 107, 113
     .   : milestone, 110,

    section CallTarget+Inlining+NGEN
    This PR (5132) - mean (728ms)  : 701, 754
     .   : milestone, 728,
    master - mean (723ms)  : 702, 744
     .   : milestone, 723,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5132) - mean (96ms)  : 92, 99
     .   : milestone, 96,
    master - mean (93ms)  : 90, 97
     .   : milestone, 93,

    section CallTarget+Inlining+NGEN
    This PR (5132) - mean (682ms)  : 659, 706
     .   : milestone, 682,
    master - mean (677ms)  : 651, 704
     .   : milestone, 677,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5132) - mean (188ms)  : 184, 191
     .   : milestone, 188,
    master - mean (189ms)  : 186, 192
     .   : milestone, 189,

    section CallTarget+Inlining+NGEN
    This PR (5132) - mean (1,079ms)  : 1050, 1109
     .   : milestone, 1079,
    master - mean (1,087ms)  : 1058, 1115
     .   : milestone, 1087,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5132) - mean (271ms)  : 267, 275
     .   : milestone, 271,
    master - mean (273ms)  : 268, 277
     .   : milestone, 273,

    section CallTarget+Inlining+NGEN
    This PR (5132) - mean (876ms)  : 851, 900
     .   : milestone, 876,
    master - mean (877ms)  : 855, 900
     .   : milestone, 877,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5132) - mean (261ms)  : 256, 266
     .   : milestone, 261,
    master - mean (262ms)  : 258, 266
     .   : milestone, 262,

    section CallTarget+Inlining+NGEN
    This PR (5132) - mean (857ms)  : 830, 883
     .   : milestone, 857,
    master - mean (859ms)  : 833, 884
     .   : milestone, 859,

Loading

@andrewlock
Copy link
Member

Throughput/Crank Report:zap:

Throughput results for AspNetCoreSimpleController comparing the following branches/commits:

Cases where throughput results for the PR are worse than latest master (5% drop or greater), results are shown in red.

Note that these results are based on a single point-in-time result for each branch. For full results, see one of the many, many dashboards!

gantt
    title Throughput Linux x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (5132) (11.583M)   : 0, 11583473
    master (11.536M)   : 0, 11536348
    benchmarks/2.9.0 (11.703M)   : 0, 11702804

    section Automatic
    This PR (5132) (7.805M)   : 0, 7805451
    master (8.011M)   : 0, 8010820
    benchmarks/2.9.0 (8.423M)   : 0, 8423113

    section Trace stats
    This PR (5132) (8.312M)   : 0, 8312083
    master (8.307M)   : 0, 8307307

    section Manual
    This PR (5132) (9.880M)   : 0, 9880276
    master (9.986M)   : 0, 9986167

    section Manual + Automatic
    This PR (5132) (7.515M)   : 0, 7515351
    master (7.555M)   : 0, 7555405

    section Version Conflict
    This PR (5132) (6.710M)   : 0, 6710103
    master (6.747M)   : 0, 6747097

Loading
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (5132) (9.748M)   : 0, 9748480
    master (9.546M)   : 0, 9546052
    benchmarks/2.9.0 (9.785M)   : 0, 9785367

    section Automatic
    This PR (5132) (6.564M)   : 0, 6564425
    master (6.675M)   : 0, 6674568

    section Trace stats
    This PR (5132) (6.961M)   : 0, 6960861
    master (6.886M)   : 0, 6885942

    section Manual
    This PR (5132) (8.262M)   : 0, 8262016
    master (8.348M)   : 0, 8348169

    section Manual + Automatic
    This PR (5132) (6.031M)   : 0, 6031283
    master (6.069M)   : 0, 6069146

    section Version Conflict
    This PR (5132) (5.680M)   : 0, 5679524
    master (5.738M)   : 0, 5737629

Loading
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (5132) (10.251M)   : 0, 10250559
    master (10.007M)   : 0, 10007231
    benchmarks/2.9.0 (10.051M)   : 0, 10050628

    section Automatic
    This PR (5132) (7.356M)   : 0, 7355736
    master (7.166M)   : 0, 7166194
    benchmarks/2.9.0 (7.541M)   : 0, 7540671

    section Trace stats
    This PR (5132) (7.612M)   : 0, 7611980
    master (7.407M)   : 0, 7407278

    section Manual
    This PR (5132) (9.157M)   : 0, 9156566
    master (8.745M)   : 0, 8745295

    section Manual + Automatic
    This PR (5132) (7.008M)   : 0, 7008014
    master (6.850M)   : 0, 6850041

    section Version Conflict
    This PR (5132) (6.328M)   : 0, 6327882
    master (6.151M)   : 0, 6151215

Loading
gantt
    title Throughput Linux x64 (ASM) (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    master (7.342M)   : 0, 7341585
    benchmarks/2.9.0 (7.875M)   : 0, 7875389

    section No attack
    master (1.739M)   : 0, 1739362
    benchmarks/2.9.0 (3.207M)   : 0, 3207025

    section Attack
    master (1.393M)   : 0, 1392667
    benchmarks/2.9.0 (2.497M)   : 0, 2496500

    section Blocking
    master (3.095M)   : 0, 3094820

    section IAST default
    master (6.430M)   : 0, 6429993

    section IAST full
    master (5.553M)   : 0, 5553214

    section Base vuln
    master (0.932M)   : 0, 931645

    section IAST vuln
    master (0.869M)   : 0, 868575

Loading

@andrewlock
Copy link
Member

Benchmarks Report 🐌

Benchmarks for #5132 compared to master:

  • 3 benchmarks are slower, with geometric mean 1.163
  • 32 benchmarks have fewer allocations
  • 13 benchmarks have more allocations

The following thresholds were used for comparing the benchmark speeds:

  • Mann–Whitney U test with statistical test for significance of 5%
  • Only results indicating a difference greater than 10% and 0.3 ns are considered.

Allocation changes below 0.5% are ignored.

Benchmark details

Benchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 8.71μs 49.4ns 359ns 0.0249 0.00831 0 7.49 KB
master StartStopWithChild netcoreapp3.1 10.5μs 42.5ns 165ns 0.0323 0.0161 0 7.59 KB
master StartStopWithChild net472 17.1μs 56.3ns 218ns 1.35 0.358 0.128 7.96 KB
#5132 StartStopWithChild net6.0 8.49μs 43.2ns 207ns 0.0218 0.00873 0 7.48 KB
#5132 StartStopWithChild netcoreapp3.1 10.8μs 57.4ns 315ns 0.0263 0.0105 0 7.58 KB
#5132 StartStopWithChild net472 17.2μs 65ns 252ns 1.33 0.324 0.0938 7.95 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 446μs 150ns 582ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 619μs 190ns 712ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 771μs 238ns 889ns 0.383 0 0 3.3 KB
#5132 WriteAndFlushEnrichedTraces net6.0 457μs 412ns 1.54μs 0 0 0 2.7 KB
#5132 WriteAndFlushEnrichedTraces netcoreapp3.1 638μs 205ns 766ns 0 0 0 2.7 KB
#5132 WriteAndFlushEnrichedTraces net472 774μs 245ns 882ns 0.386 0 0 3.3 KB
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Slower ⚠️ More allocations ⚠️

Slower ⚠️ in #5132

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody‑netcoreapp3.1 1.209 212.43 256.75

More allocations ⚠️ in #5132

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑net472 2.41 KB 2.45 KB 40 B 1.66%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑netcoreapp3.1 2.34 KB 2.37 KB 32 B 1.37%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑net6.0 2.36 KB 2.39 KB 32 B 1.36%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 38.8μs 18.9ns 73.3ns 0.0192 0 0 2.36 KB
master AllCycleSimpleBody netcoreapp3.1 42.5μs 62.7ns 234ns 0.0212 0 0 2.34 KB
master AllCycleSimpleBody net472 44.8μs 15ns 56ns 0.381 0 0 2.41 KB
master AllCycleMoreComplexBody net6.0 202μs 87.1ns 337ns 0.102 0 0 9.84 KB
master AllCycleMoreComplexBody netcoreapp3.1 215μs 210ns 814ns 0.107 0 0 9.73 KB
master AllCycleMoreComplexBody net472 226μs 102ns 396ns 1.49 0 0 9.91 KB
master ObjectExtractorSimpleBody net6.0 137ns 0.199ns 0.769ns 0.00391 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 212ns 0.145ns 0.563ns 0.0037 0 0 272 B
master ObjectExtractorSimpleBody net472 167ns 0.149ns 0.578ns 0.0446 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 3μs 2.13ns 8.24ns 0.0527 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 4.08μs 2.73ns 10.6ns 0.0513 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 3.83μs 4.67ns 18.1ns 0.602 0.00579 0 3.8 KB
#5132 AllCycleSimpleBody net6.0 39.1μs 17.7ns 68.7ns 0.0197 0 0 2.39 KB
#5132 AllCycleSimpleBody netcoreapp3.1 42.4μs 32.8ns 123ns 0.0211 0 0 2.37 KB
#5132 AllCycleSimpleBody net472 45.2μs 20.6ns 77.2ns 0.385 0 0 2.45 KB
#5132 AllCycleMoreComplexBody net6.0 202μs 202ns 782ns 0.101 0 0 9.87 KB
#5132 AllCycleMoreComplexBody netcoreapp3.1 212μs 97.1ns 376ns 0.106 0 0 9.76 KB
#5132 AllCycleMoreComplexBody net472 227μs 164ns 635ns 1.47 0 0 9.95 KB
#5132 ObjectExtractorSimpleBody net6.0 139ns 0.138ns 0.535ns 0.00396 0 0 280 B
#5132 ObjectExtractorSimpleBody netcoreapp3.1 257ns 0.206ns 0.799ns 0.00373 0 0 272 B
#5132 ObjectExtractorSimpleBody net472 164ns 0.16ns 0.597ns 0.0446 0 0 281 B
#5132 ObjectExtractorMoreComplexBody net6.0 3.03μs 1.98ns 7.69ns 0.0533 0 0 3.78 KB
#5132 ObjectExtractorMoreComplexBody netcoreapp3.1 4.08μs 1.97ns 7.39ns 0.0492 0 0 3.69 KB
#5132 ObjectExtractorMoreComplexBody net472 3.8μs 2.95ns 11.4ns 0.603 0.00569 0 3.8 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #5132

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafWithAttack(args: NestedMap (10, attack))‑net472 19.72 KB 23.33 KB 3.61 KB 18.31%
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafWithAttack(args: NestedMap (10, attack))‑netcoreapp3.1 19.44 KB 22.98 KB 3.54 KB 18.23%
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafWithAttack(args: NestedMap (10, attack))‑net6.0 19.49 KB 23.03 KB 3.54 KB 18.19%
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafWithAttack(args: NestedMap (20, attack))‑net472 36.22 KB 39.83 KB 3.61 KB 9.97%
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafWithAttack(args: NestedMap (20, attack))‑net6.0 35.61 KB 39.15 KB 3.54 KB 9.95%
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafWithAttack(args: NestedMap (20, attack))‑netcoreapp3.1 35.68 KB 39.22 KB 3.54 KB 9.93%
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafWithAttack(args: NestedMap (100, attack))‑net6.0 36.18 KB 39.73 KB 3.54 KB 9.79%
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafWithAttack(args: NestedMap (100, attack))‑net472 37.26 KB 40.87 KB 3.61 KB 9.68%
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafWithAttack(args: NestedMap (100, attack))‑netcoreapp3.1 36.71 KB 40.26 KB 3.54 KB 9.65%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWaf(args=NestedMap (10)) net6.0 57μs 327ns 2.49μs 0.227 0 0 16.66 KB
master RunWaf(args=NestedMap (10)) netcoreapp3.1 68.7μs 304ns 1.05μs 0.201 0 0 16.65 KB
master RunWaf(args=NestedMap (10)) net472 102μs 211ns 818ns 2.65 0.0982 0 16.73 KB
master RunWafTwice(args=NestedMap (10)) net6.0 56.8μs 323ns 2.35μs 0.221 0 0 17.33 KB
master RunWafTwice(args=NestedMap (10)) netcoreapp3.1 73.1μs 179ns 692ns 0.215 0 0 17.31 KB
master RunWafTwice(args=NestedMap (10)) net472 107μs 376ns 1.46μs 2.73 0.105 0 17.42 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 104μs 552ns 2.92μs 0.254 0 0 19.49 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 122μs 620ns 2.84μs 0.238 0 0 19.44 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net472 150μs 121ns 469ns 3.08 0.15 0 19.72 KB
master RunWaf(args=NestedMap (100)) net6.0 100μs 46.2ns 179ns 0.45 0 0 33.35 KB
master RunWaf(args=NestedMap (100)) netcoreapp3.1 138μs 456ns 1.77μs 0.413 0 0 33.92 KB
master RunWaf(args=NestedMap (100)) net472 192μs 818ns 3.17μs 5.37 0.377 0 34.26 KB
master RunWafTwice(args=NestedMap (100)) net6.0 107μs 115ns 446ns 0.478 0 0 34.02 KB
master RunWafTwice(args=NestedMap (100)) netcoreapp3.1 140μs 707ns 3.39μs 0.423 0 0 34.58 KB
master RunWafTwice(args=NestedMap (100)) net472 200μs 177ns 661ns 5.48 0.399 0 34.96 KB
master RunWafWithAttack(args=Neste(...)tack) [23]) net6.0 157μs 84.2ns 315ns 0.475 0 0 36.18 KB
master RunWafWithAttack(args=Neste(...)tack) [23]) netcoreapp3.1 188μs 908ns 3.85μs 0.456 0 0 36.71 KB
master RunWafWithAttack(args=Neste(...)tack) [23]) net472 248μs 212ns 820ns 5.85 0.374 0 37.26 KB
master RunWaf(args=NestedMap (20)) net6.0 105μs 589ns 3.82μs 0.434 0 0 32.78 KB
master RunWaf(args=NestedMap (20)) netcoreapp3.1 140μs 674ns 2.94μs 0.393 0 0 32.89 KB
master RunWaf(args=NestedMap (20)) net472 189μs 104ns 360ns 5.19 0.378 0 33.23 KB
master RunWafTwice(args=NestedMap (20)) net6.0 103μs 14ns 50.6ns 0.466 0 0 33.45 KB
master RunWafTwice(args=NestedMap (20)) netcoreapp3.1 141μs 786ns 4.72μs 0.408 0 0 33.55 KB
master RunWafTwice(args=NestedMap (20)) net472 196μs 83.7ns 313ns 5.39 0.392 0 33.92 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 156μs 696ns 2.6μs 0.464 0 0 35.61 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 195μs 956ns 4.38μs 0.459 0 0 35.68 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net472 250μs 767ns 2.97μs 5.73 0.487 0 36.22 KB
#5132 RunWaf(args=NestedMap (10)) net6.0 56.4μs 18.7ns 72.6ns 0.225 0 0 16.69 KB
#5132 RunWaf(args=NestedMap (10)) netcoreapp3.1 71.1μs 43.8ns 152ns 0.211 0 0 16.68 KB
#5132 RunWaf(args=NestedMap (10)) net472 101μs 166ns 644ns 2.62 0.099 0 16.77 KB
#5132 RunWafTwice(args=NestedMap (10)) net6.0 55.1μs 22.2ns 83.2ns 0.222 0 0 17.39 KB
#5132 RunWafTwice(args=NestedMap (10)) netcoreapp3.1 74.6μs 131ns 506ns 0.223 0 0 17.38 KB
#5132 RunWafTwice(args=NestedMap (10)) net472 106μs 97.9ns 379ns 2.75 0.106 0 17.5 KB
#5132 RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 110μs 119ns 462ns 0.285 0 0 23.03 KB
#5132 RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 131μs 503ns 1.95μs 0.321 0 0 22.98 KB
#5132 RunWafWithAttack(args=Neste(...)tack) [22]) net472 160μs 87.8ns 304ns 3.68 0.16 0 23.33 KB
#5132 RunWaf(args=NestedMap (100)) net6.0 103μs 27.5ns 106ns 0.462 0 0 33.38 KB
#5132 RunWaf(args=NestedMap (100)) netcoreapp3.1 136μs 683ns 3.2μs 0.412 0 0 33.95 KB
#5132 RunWaf(args=NestedMap (100)) net472 193μs 677ns 2.62μs 5.41 0.379 0 34.31 KB
#5132 RunWafTwice(args=NestedMap (100)) net6.0 103μs 36.5ns 142ns 0.465 0 0 34.09 KB
#5132 RunWafTwice(args=NestedMap (100)) netcoreapp3.1 135μs 64.8ns 251ns 0.424 0 0 34.65 KB
#5132 RunWafTwice(args=NestedMap (100)) net472 203μs 140ns 542ns 5.53 0.395 0 35.04 KB
#5132 RunWafWithAttack(args=Neste(...)tack) [23]) net6.0 165μs 59.6ns 223ns 0.495 0 0 39.73 KB
#5132 RunWafWithAttack(args=Neste(...)tack) [23]) netcoreapp3.1 195μs 161ns 581ns 0.496 0 0 40.26 KB
#5132 RunWafWithAttack(args=Neste(...)tack) [23]) net472 256μs 198ns 768ns 6.4 0.512 0 40.87 KB
#5132 RunWaf(args=NestedMap (20)) net6.0 99.9μs 31ns 120ns 0.428 0 0 32.81 KB
#5132 RunWaf(args=NestedMap (20)) netcoreapp3.1 136μs 780ns 3.12μs 0.417 0 0 32.92 KB
#5132 RunWaf(args=NestedMap (20)) net472 187μs 234ns 907ns 5.22 0.373 0 33.27 KB
#5132 RunWafTwice(args=NestedMap (20)) net6.0 104μs 55.5ns 200ns 0.47 0 0 33.51 KB
#5132 RunWafTwice(args=NestedMap (20)) netcoreapp3.1 134μs 60.7ns 243ns 0.402 0 0 33.62 KB
#5132 RunWafTwice(args=NestedMap (20)) net472 199μs 139ns 536ns 5.35 0.389 0 34 KB
#5132 RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 161μs 234ns 906ns 0.486 0 0 39.15 KB
#5132 RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 204μs 1μs 4.13μs 0.517 0 0 39.22 KB
#5132 RunWafWithAttack(args=Neste(...)tack) [22]) net472 254μs 119ns 459ns 6.33 0.506 0 39.83 KB
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net6.0 171μs 168ns 649ns 0.172 0 0 18.26 KB
master SendRequest netcoreapp3.1 193μs 326ns 1.26μs 0.192 0 0 20.42 KB
master SendRequest net472 0.000322ns 0.000146ns 0.000528ns 0 0 0 0 b
#5132 SendRequest net6.0 172μs 114ns 411ns 0.172 0 0 18.25 KB
#5132 SendRequest netcoreapp3.1 192μs 432ns 1.67μs 0.191 0 0 20.41 KB
#5132 SendRequest net472 0.00117ns 0.000598ns 0.00224ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 558μs 1.7μs 6.37μs 0.548 0 0 41.42 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 661μs 559ns 2.16μs 0.329 0 0 41.74 KB
master WriteAndFlushEnrichedTraces net472 855μs 2.98μs 11.5μs 8.19 2.59 0.431 53.23 KB
#5132 WriteAndFlushEnrichedTraces net6.0 556μs 924ns 3.58μs 0.556 0 0 41.41 KB
#5132 WriteAndFlushEnrichedTraces netcoreapp3.1 648μs 580ns 2.25μs 0.326 0 0 41.81 KB
#5132 WriteAndFlushEnrichedTraces net472 857μs 1.25μs 4.85μs 8.22 2.47 0.411 53.25 KB
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #5132

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑net6.0 776 B 768 B -8 B -1.03%
Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑netcoreapp3.1 776 B 768 B -8 B -1.03%
Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑net472 738 B 730 B -8 B -1.08%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 1.06μs 0.611ns 2.37ns 0.0111 0 0 776 B
master ExecuteNonQuery netcoreapp3.1 1.47μs 4.28ns 16.6ns 0.0101 0 0 776 B
master ExecuteNonQuery net472 1.84μs 3.81ns 14.7ns 0.117 0 0 738 B
#5132 ExecuteNonQuery net6.0 1.11μs 0.463ns 1.79ns 0.0106 0 0 768 B
#5132 ExecuteNonQuery netcoreapp3.1 1.45μs 2.61ns 10.1ns 0.00993 0 0 768 B
#5132 ExecuteNonQuery net472 1.84μs 1.3ns 5.03ns 0.116 0 0 730 B
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #5132

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑net472 1.02 KB 1.01 KB -8 B -0.79%
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑netcoreapp3.1 992 B 984 B -8 B -0.81%
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑net472 963 B 955 B -8 B -0.83%
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑net6.0 944 B 936 B -8 B -0.85%
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑netcoreapp3.1 944 B 936 B -8 B -0.85%
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑net6.0 920 B 912 B -8 B -0.87%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.2μs 0.932ns 3.61ns 0.0133 0 0 944 B
master CallElasticsearch netcoreapp3.1 1.44μs 0.656ns 2.46ns 0.0127 0 0 944 B
master CallElasticsearch net472 2.43μs 1.07ns 4.16ns 0.153 0 0 963 B
master CallElasticsearchAsync net6.0 1.25μs 0.724ns 2.51ns 0.0125 0 0 920 B
master CallElasticsearchAsync netcoreapp3.1 1.63μs 1.42ns 5.13ns 0.0131 0 0 992 B
master CallElasticsearchAsync net472 2.63μs 1.26ns 4.88ns 0.161 0 0 1.02 KB
#5132 CallElasticsearch net6.0 1.12μs 0.314ns 1.22ns 0.0135 0 0 936 B
#5132 CallElasticsearch netcoreapp3.1 1.58μs 0.679ns 2.45ns 0.0123 0 0 936 B
#5132 CallElasticsearch net472 2.57μs 0.87ns 3.01ns 0.152 0 0 955 B
#5132 CallElasticsearchAsync net6.0 1.31μs 2.82ns 10.9ns 0.0131 0 0 912 B
#5132 CallElasticsearchAsync netcoreapp3.1 1.7μs 0.93ns 3.48ns 0.0136 0 0 984 B
#5132 CallElasticsearchAsync net472 2.68μs 1.35ns 5.24ns 0.161 0 0 1.01 KB
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #5132

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net6.0 920 B 912 B -8 B -0.87%
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑netcoreapp3.1 920 B 912 B -8 B -0.87%
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net472 883 B 875 B -8 B -0.91%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net6.0 1.36μs 2.47ns 9.57ns 0.0128 0 0 920 B
master ExecuteAsync netcoreapp3.1 1.58μs 0.98ns 3.67ns 0.0118 0 0 920 B
master ExecuteAsync net472 1.84μs 0.841ns 3.15ns 0.14 0 0 883 B
#5132 ExecuteAsync net6.0 1.34μs 0.688ns 2.67ns 0.0129 0 0 912 B
#5132 ExecuteAsync netcoreapp3.1 1.52μs 0.886ns 3.32ns 0.0125 0 0 912 B
#5132 ExecuteAsync net472 1.87μs 0.719ns 2.78ns 0.139 0 0 875 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 4.08μs 2.1ns 8.12ns 0.0287 0 0 2.1 KB
master SendAsync netcoreapp3.1 4.98μs 2.59ns 10ns 0.0349 0 0 2.64 KB
master SendAsync net472 7.69μs 2.61ns 9.78ns 0.525 0 0 3.31 KB
#5132 SendAsync net6.0 4.16μs 1.27ns 4.94ns 0.0291 0 0 2.1 KB
#5132 SendAsync netcoreapp3.1 4.94μs 2.36ns 9.13ns 0.0349 0 0 2.63 KB
#5132 SendAsync net472 7.83μs 3.11ns 11.6ns 0.523 0 0 3.31 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #5132

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 203.69 KB 212.81 KB 9.12 KB 4.48%

Fewer allocations 🎉 in #5132

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 59.22 KB 57.34 KB -1.87 KB -3.16%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472 229.38 KB 221.18 KB -8.19 KB -3.57%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 246.45 KB 215.65 KB -30.8 KB -12.50%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 57.4μs 675ns 6.68μs 0 0 0 43.44 KB
master StringConcatBenchmark netcoreapp3.1 53.4μs 230ns 796ns 0 0 0 42.64 KB
master StringConcatBenchmark net472 37.7μs 88.2ns 318ns 0 0 0 59.22 KB
master StringConcatAspectBenchmark net6.0 251μs 3.62μs 33.6μs 0 0 0 246.45 KB
master StringConcatAspectBenchmark netcoreapp3.1 286μs 1.24μs 7.14μs 0 0 0 203.69 KB
master StringConcatAspectBenchmark net472 226μs 994ns 4.1μs 0 0 0 229.38 KB
#5132 StringConcatBenchmark net6.0 57.3μs 1.15μs 10.9μs 0 0 0 43.44 KB
#5132 StringConcatBenchmark netcoreapp3.1 60.4μs 858ns 8.41μs 0 0 0 42.64 KB
#5132 StringConcatBenchmark net472 38μs 139ns 521ns 0 0 0 57.34 KB
#5132 StringConcatAspectBenchmark net6.0 284μs 1.47μs 8.06μs 0 0 0 215.65 KB
#5132 StringConcatAspectBenchmark netcoreapp3.1 269μs 2.7μs 25.7μs 0 0 0 212.81 KB
#5132 StringConcatAspectBenchmark net472 238μs 4.5μs 42.4μs 0 0 0 221.18 KB
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #5132

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ILoggerBenchmark.EnrichedLog‑net6.0 1.58 KB 1.57 KB -8 B -0.51%
Benchmarks.Trace.ILoggerBenchmark.EnrichedLog‑netcoreapp3.1 1.58 KB 1.57 KB -8 B -0.51%
Benchmarks.Trace.ILoggerBenchmark.EnrichedLog‑net472 1.51 KB 1.5 KB -8 B -0.53%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 1.42μs 0.828ns 3.1ns 0.022 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 2.19μs 1.34ns 5.18ns 0.0219 0 0 1.58 KB
master EnrichedLog net472 2.79μs 3.04ns 11ns 0.239 0 0 1.51 KB
#5132 EnrichedLog net6.0 1.42μs 0.707ns 2.64ns 0.0221 0 0 1.57 KB
#5132 EnrichedLog netcoreapp3.1 2.1μs 3.38ns 12.7ns 0.0211 0 0 1.57 KB
#5132 EnrichedLog net472 2.59μs 2.39ns 8.95ns 0.237 0 0 1.5 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 112μs 103ns 399ns 0.0563 0 0 4.22 KB
master EnrichedLog netcoreapp3.1 119μs 215ns 834ns 0 0 0 4.22 KB
master EnrichedLog net472 148μs 66.6ns 258ns 0.664 0.221 0 4.4 KB
#5132 EnrichedLog net6.0 112μs 62.6ns 226ns 0.0559 0 0 4.21 KB
#5132 EnrichedLog netcoreapp3.1 117μs 204ns 792ns 0.0585 0 0 4.21 KB
#5132 EnrichedLog net472 149μs 233ns 873ns 0.663 0.221 0 4.39 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 3.1μs 0.9ns 3.48ns 0.0294 0 0 2.14 KB
master EnrichedLog netcoreapp3.1 4.14μs 6.46ns 23.3ns 0.029 0 0 2.14 KB
master EnrichedLog net472 4.74μs 3.36ns 13ns 0.31 0 0 1.95 KB
#5132 EnrichedLog net6.0 3.12μs 0.981ns 3.8ns 0.0297 0 0 2.13 KB
#5132 EnrichedLog netcoreapp3.1 4.28μs 1.24ns 4.82ns 0.0279 0 0 2.13 KB
#5132 EnrichedLog net472 4.77μs 2.71ns 10.5ns 0.307 0 0 1.95 KB
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #5132

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.RedisBenchmark.SendReceive‑net472 1.12 KB 1.12 KB -8 B -0.71%
Benchmarks.Trace.RedisBenchmark.SendReceive‑net6.0 1.11 KB 1.1 KB -8 B -0.72%
Benchmarks.Trace.RedisBenchmark.SendReceive‑netcoreapp3.1 1.11 KB 1.1 KB -8 B -0.72%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendReceive net6.0 1.37μs 0.409ns 1.53ns 0.0158 0 0 1.11 KB
master SendReceive netcoreapp3.1 1.86μs 0.777ns 3.01ns 0.0146 0 0 1.11 KB
master SendReceive net472 2.2μs 1.95ns 7.29ns 0.178 0 0 1.12 KB
#5132 SendReceive net6.0 1.41μs 0.753ns 2.92ns 0.0155 0 0 1.1 KB
#5132 SendReceive netcoreapp3.1 1.87μs 1.4ns 5.44ns 0.0149 0 0 1.1 KB
#5132 SendReceive net472 2.2μs 2.19ns 8.48ns 0.177 0 0 1.12 KB
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #5132

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.SerilogBenchmark.EnrichedLog‑netcoreapp3.1 1.58 KB 1.58 KB -8 B -0.51%
Benchmarks.Trace.SerilogBenchmark.EnrichedLog‑net6.0 1.54 KB 1.53 KB -8 B -0.52%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 2.77μs 1.16ns 4.33ns 0.0208 0 0 1.54 KB
master EnrichedLog netcoreapp3.1 3.82μs 1.44ns 5.57ns 0.0216 0 0 1.58 KB
master EnrichedLog net472 4.29μs 2.74ns 10.6ns 0.313 0 0 1.97 KB
#5132 EnrichedLog net6.0 2.81μs 1.05ns 3.93ns 0.0211 0 0 1.53 KB
#5132 EnrichedLog netcoreapp3.1 3.98μs 1.43ns 5.54ns 0.0219 0 0 1.58 KB
#5132 EnrichedLog net472 4.36μs 2.02ns 7.3ns 0.31 0 0 1.97 KB
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ Fewer allocations 🎉

Slower ⚠️ in #5132

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net472 1.124 738.90 830.48

Fewer allocations 🎉 in #5132

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 664 B 656 B -8 B -1.20%
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑netcoreapp3.1 664 B 656 B -8 B -1.20%
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net472 626 B 618 B -8 B -1.28%
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net472 546 B 538 B -8 B -1.47%
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 544 B 536 B -8 B -1.47%
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 544 B 536 B -8 B -1.47%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 580ns 0.172ns 0.645ns 0.00751 0 0 544 B
master StartFinishSpan netcoreapp3.1 780ns 0.441ns 1.65ns 0.00764 0 0 544 B
master StartFinishSpan net472 739ns 0.179ns 0.694ns 0.0865 0 0 546 B
master StartFinishScope net6.0 603ns 0.139ns 0.537ns 0.00935 0 0 664 B
master StartFinishScope netcoreapp3.1 933ns 0.919ns 3.56ns 0.0089 0 0 664 B
master StartFinishScope net472 1μs 0.292ns 1.09ns 0.0993 0 0 626 B
#5132 StartFinishSpan net6.0 559ns 0.164ns 0.635ns 0.00755 0 0 536 B
#5132 StartFinishSpan netcoreapp3.1 753ns 0.645ns 2.5ns 0.00732 0 0 536 B
#5132 StartFinishSpan net472 830ns 0.241ns 0.935ns 0.0851 0 0 538 B
#5132 StartFinishScope net6.0 544ns 0.218ns 0.846ns 0.00918 0 0 656 B
#5132 StartFinishScope netcoreapp3.1 836ns 1.34ns 5.17ns 0.00884 0 0 656 B
#5132 StartFinishScope net472 1.02μs 0.528ns 2.04ns 0.0977 0 0 618 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Slower ⚠️ Fewer allocations 🎉

Slower ⚠️ in #5132

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑netcoreapp3.1 1.157 864.29 999.70

Fewer allocations 🎉 in #5132

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 664 B 656 B -8 B -1.20%
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑netcoreapp3.1 664 B 656 B -8 B -1.20%
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net472 626 B 618 B -8 B -1.28%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 691ns 0.52ns 2.01ns 0.00926 0 0 664 B
master RunOnMethodBegin netcoreapp3.1 865ns 0.633ns 2.28ns 0.00876 0 0 664 B
master RunOnMethodBegin net472 1.12μs 0.585ns 2.27ns 0.0993 0 0 626 B
#5132 RunOnMethodBegin net6.0 679ns 0.449ns 1.74ns 0.00915 0 0 656 B
#5132 RunOnMethodBegin netcoreapp3.1 993ns 3.34ns 12.9ns 0.00881 0 0 656 B
#5132 RunOnMethodBegin net472 1.09μs 0.495ns 1.92ns 0.098 0 0 618 B

Copy link
Contributor

@GreenMatan GreenMatan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dudikeleti dudikeleti force-pushed the dudik/reduce-allocations-in-probes branch from 50c63a0 to 4670922 Compare March 22, 2024 14:25
@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Mar 22, 2024

Datadog Report

Branch report: dudik/reduce-allocations-in-probes
Commit report: 26c2a0d
Test service: dd-trace-dotnet

✅ 0 Failed, 333619 Passed, 2057 Skipped, 57m 4.21s Wall Time

@andrewlock
Copy link
Member

Benchmarks Report for tracer 🐌

Benchmarks for #5132 compared to master:

  • All benchmarks have the same speed
  • 1 benchmarks have fewer allocations

The following thresholds were used for comparing the benchmark speeds:

  • Mann–Whitney U test with statistical test for significance of 5%
  • Only results indicating a difference greater than 10% and 0.3 ns are considered.

Allocation changes below 0.5% are ignored.

Benchmark details

Benchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 8.8μs 48.4ns 290ns 0.0219 0.00877 0 7.51 KB
master StartStopWithChild netcoreapp3.1 10.7μs 52.4ns 216ns 0.0261 0.0104 0 7.6 KB
master StartStopWithChild net472 16.8μs 43ns 155ns 1.34 0.332 0.108 8.06 KB
#5132 StartStopWithChild net6.0 8.98μs 50.4ns 319ns 0.0215 0.00862 0 7.5 KB
#5132 StartStopWithChild netcoreapp3.1 10.8μs 60.7ns 412ns 0.0272 0.0109 0 7.6 KB
#5132 StartStopWithChild net472 16.8μs 78.3ns 303ns 1.37 0.372 0.127 8.05 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 470μs 170ns 657ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 606μs 142ns 513ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 807μs 221ns 828ns 0.403 0 0 3.3 KB
#5132 WriteAndFlushEnrichedTraces net6.0 465μs 143ns 554ns 0 0 0 2.7 KB
#5132 WriteAndFlushEnrichedTraces netcoreapp3.1 622μs 149ns 517ns 0 0 0 2.7 KB
#5132 WriteAndFlushEnrichedTraces net472 807μs 506ns 1.96μs 0.403 0 0 3.3 KB
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net6.0 173μs 161ns 623ns 0.174 0 0 18.33 KB
master SendRequest netcoreapp3.1 194μs 326ns 1.26μs 0.195 0 0 20.49 KB
master SendRequest net472 0.000278ns 0.000141ns 0.000528ns 0 0 0 0 b
#5132 SendRequest net6.0 171μs 234ns 876ns 0.171 0 0 18.33 KB
#5132 SendRequest netcoreapp3.1 194μs 404ns 1.57μs 0.195 0 0 20.49 KB
#5132 SendRequest net472 0.000644ns 0.000275ns 0.00107ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #5132

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 41.74 KB 41.42 KB -313 B -0.75%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 551μs 670ns 2.59μs 0.548 0 0 41.74 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 659μs 675ns 2.53μs 0.324 0 0 41.69 KB
master WriteAndFlushEnrichedTraces net472 859μs 3.66μs 14.2μs 8.08 2.55 0.425 53.24 KB
#5132 WriteAndFlushEnrichedTraces net6.0 538μs 1.23μs 4.75μs 0.553 0 0 41.42 KB
#5132 WriteAndFlushEnrichedTraces netcoreapp3.1 655μs 861ns 3.33μs 0.329 0 0 41.74 KB
#5132 WriteAndFlushEnrichedTraces net472 843μs 3.73μs 14μs 8.33 2.5 0.417 53.22 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.17μs 0.406ns 1.57ns 0.0105 0 0 784 B
master ExecuteNonQuery netcoreapp3.1 1.46μs 6.09ns 23.6ns 0.0102 0 0 784 B
master ExecuteNonQuery net472 1.85μs 0.726ns 2.72ns 0.118 0 0 746 B
#5132 ExecuteNonQuery net6.0 1.07μs 0.879ns 3.4ns 0.0112 0 0 784 B
#5132 ExecuteNonQuery netcoreapp3.1 1.54μs 0.867ns 3.36ns 0.0106 0 0 784 B
#5132 ExecuteNonQuery net472 1.84μs 1.5ns 5.4ns 0.118 0 0 746 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.29μs 0.61ns 2.28ns 0.0143 0 0 1.01 KB
master CallElasticsearch netcoreapp3.1 1.56μs 0.769ns 2.98ns 0.0133 0 0 1.01 KB
master CallElasticsearch net472 2.51μs 1.49ns 5.59ns 0.161 0 0 1.02 KB
master CallElasticsearchAsync net6.0 1.42μs 1.21ns 4.51ns 0.0135 0 0 984 B
master CallElasticsearchAsync netcoreapp3.1 1.72μs 2.27ns 8.8ns 0.0137 0 0 1.06 KB
master CallElasticsearchAsync net472 2.58μs 1.53ns 5.91ns 0.17 0.00129 0 1.08 KB
#5132 CallElasticsearch net6.0 1.22μs 0.929ns 3.48ns 0.0146 0 0 1.01 KB
#5132 CallElasticsearch netcoreapp3.1 1.53μs 0.734ns 2.54ns 0.0139 0 0 1.01 KB
#5132 CallElasticsearch net472 2.61μs 2.38ns 9.21ns 0.161 0 0 1.02 KB
#5132 CallElasticsearchAsync net6.0 1.41μs 1.68ns 6.52ns 0.0133 0 0 984 B
#5132 CallElasticsearchAsync netcoreapp3.1 1.77μs 1.77ns 6.61ns 0.0142 0 0 1.06 KB
#5132 CallElasticsearchAsync net472 2.68μs 1.09ns 4.1ns 0.17 0 0 1.08 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.28μs 0.936ns 3.5ns 0.0131 0 0 928 B
master ExecuteAsync netcoreapp3.1 1.7μs 1.21ns 4.52ns 0.0126 0 0 928 B
master ExecuteAsync net472 1.94μs 2.51ns 9.74ns 0.141 0 0 891 B
#5132 ExecuteAsync net6.0 1.37μs 1.21ns 4.53ns 0.0131 0 0 928 B
#5132 ExecuteAsync netcoreapp3.1 1.71μs 1.32ns 4.92ns 0.012 0 0 928 B
#5132 ExecuteAsync net472 1.92μs 1.9ns 7.1ns 0.141 0 0 891 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 4.28μs 2.92ns 11.3ns 0.0298 0 0 2.16 KB
master SendAsync netcoreapp3.1 5.05μs 1.84ns 7.12ns 0.0355 0 0 2.7 KB
master SendAsync net472 7.62μs 6.03ns 22.6ns 0.484 0 0 3.05 KB
#5132 SendAsync net6.0 4.1μs 2.6ns 10.1ns 0.0307 0 0 2.16 KB
#5132 SendAsync netcoreapp3.1 5μs 2.76ns 10.7ns 0.0348 0 0 2.7 KB
#5132 SendAsync net472 7.68μs 8.7ns 33.7ns 0.482 0 0 3.05 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 1.52μs 0.889ns 3.2ns 0.0232 0 0 1.65 KB
master EnrichedLog netcoreapp3.1 2.27μs 3.02ns 11.7ns 0.0228 0 0 1.65 KB
master EnrichedLog net472 2.69μs 1.31ns 4.89ns 0.25 0 0 1.57 KB
#5132 EnrichedLog net6.0 1.51μs 0.996ns 3.86ns 0.0228 0 0 1.65 KB
#5132 EnrichedLog netcoreapp3.1 2.31μs 2.14ns 8.01ns 0.022 0 0 1.65 KB
#5132 EnrichedLog net472 2.69μs 3.33ns 12ns 0.249 0 0 1.57 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 113μs 125ns 449ns 0.0568 0 0 4.23 KB
master EnrichedLog netcoreapp3.1 123μs 368ns 1.42μs 0 0 0 4.23 KB
master EnrichedLog net472 148μs 188ns 727ns 0.664 0.221 0 4.41 KB
#5132 EnrichedLog net6.0 114μs 128ns 495ns 0.0566 0 0 4.23 KB
#5132 EnrichedLog netcoreapp3.1 120μs 177ns 686ns 0.0599 0 0 4.23 KB
#5132 EnrichedLog net472 147μs 123ns 476ns 0.659 0.22 0 4.41 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 3.13μs 1.19ns 4.11ns 0.0311 0 0 2.21 KB
master EnrichedLog netcoreapp3.1 4.22μs 0.966ns 3.35ns 0.0294 0 0 2.21 KB
master EnrichedLog net472 5.19μs 5.71ns 22.1ns 0.321 0 0 2.02 KB
#5132 EnrichedLog net6.0 2.91μs 2.85ns 10.7ns 0.0306 0 0 2.21 KB
#5132 EnrichedLog netcoreapp3.1 4.24μs 2.84ns 11ns 0.0298 0 0 2.21 KB
#5132 EnrichedLog net472 5.05μs 5.85ns 20.3ns 0.321 0 0 2.02 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.43μs 0.878ns 3.4ns 0.0164 0 0 1.18 KB
master SendReceive netcoreapp3.1 1.8μs 8.43ns 33.7ns 0.0162 0 0 1.18 KB
master SendReceive net472 2.42μs 4.09ns 15.9ns 0.187 0 0 1.18 KB
#5132 SendReceive net6.0 1.39μs 2.3ns 8.6ns 0.0164 0 0 1.18 KB
#5132 SendReceive netcoreapp3.1 1.88μs 4.26ns 16.5ns 0.0152 0 0 1.18 KB
#5132 SendReceive net472 2.41μs 1.9ns 7.12ns 0.187 0 0 1.18 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 2.79μs 0.877ns 3.28ns 0.0209 0 0 1.55 KB
master EnrichedLog netcoreapp3.1 3.88μs 1.42ns 5.3ns 0.0212 0 0 1.6 KB
master EnrichedLog net472 4.71μs 2.69ns 10.4ns 0.314 0 0 1.99 KB
#5132 EnrichedLog net6.0 2.85μs 0.651ns 2.35ns 0.0213 0 0 1.55 KB
#5132 EnrichedLog netcoreapp3.1 4.02μs 1.39ns 5.2ns 0.0201 0 0 1.6 KB
#5132 EnrichedLog net472 4.45μs 2.4ns 9.31ns 0.315 0 0 1.99 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 479ns 0.328ns 1.27ns 0.00771 0 0 552 B
master StartFinishSpan netcoreapp3.1 759ns 1.09ns 4.07ns 0.00722 0 0 552 B
master StartFinishSpan net472 718ns 0.675ns 2.61ns 0.0879 0 0 554 B
master StartFinishScope net6.0 594ns 0.291ns 1.13ns 0.00954 0 0 672 B
master StartFinishScope netcoreapp3.1 897ns 0.649ns 2.43ns 0.00872 0 0 672 B
master StartFinishScope net472 971ns 0.64ns 2.31ns 0.1 0 0 634 B
#5132 StartFinishSpan net6.0 524ns 0.75ns 2.9ns 0.00767 0 0 552 B
#5132 StartFinishSpan netcoreapp3.1 712ns 0.67ns 2.59ns 0.00746 0 0 552 B
#5132 StartFinishSpan net472 749ns 1.31ns 5.06ns 0.0877 0 0 554 B
#5132 StartFinishScope net6.0 585ns 0.725ns 2.81ns 0.00936 0 0 672 B
#5132 StartFinishScope netcoreapp3.1 838ns 1.02ns 3.96ns 0.00906 0 0 672 B
#5132 StartFinishScope net472 975ns 1.03ns 3.71ns 0.1 0 0 634 B
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 658ns 0.817ns 3.17ns 0.00945 0 0 672 B
master RunOnMethodBegin netcoreapp3.1 950ns 0.6ns 2.32ns 0.00894 0 0 672 B
master RunOnMethodBegin net472 1.07μs 1.07ns 4.16ns 0.101 0 0 634 B
#5132 RunOnMethodBegin net6.0 714ns 0.338ns 1.31ns 0.00933 0 0 672 B
#5132 RunOnMethodBegin netcoreapp3.1 936ns 0.351ns 1.31ns 0.00892 0 0 672 B
#5132 RunOnMethodBegin net472 1.11μs 0.349ns 1.21ns 0.1 0 0 634 B

@dudikeleti dudikeleti merged commit 0e28087 into master Apr 4, 2024
58 of 61 checks passed
@dudikeleti dudikeleti deleted the dudik/reduce-allocations-in-probes branch April 4, 2024 14:18
@github-actions github-actions bot added this to the vNext-v2 milestone Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:debugger area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants