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

baggage propagator clean up #6266

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Conversation

lucaspimentel
Copy link
Member

@lucaspimentel lucaspimentel commented Nov 8, 2024

Summary of changes

Refactored how we generated the baggage header value in W3CBaggagePropagator to be faster and minimize heap allocations.

Reason for change

Performance

Implementation details

1. string and StringBuilder management

We now use a single StringBuilder (from StringBuilderCache) to build the entire baggage header. Previously the code was trying to acquire a builder to encode keys and values while already holding another builder for the header itself. With this change, we no longer allocate multiple StringBuilder instances that don't get reused, and we no longer allocation individual strings for:

  • keys that need encoding
  • values that need encoding
  • every key/value pair (the string was built first to measure its length in UTF-8 bytes, but we don't need that anymore)

2. checking earlier if string needs encoding

Before this PR, we always converted every key and value into UTF-8 bytes before checking if any bytes needed percent-encoding (aka url-encoding). When encoding was not needed (the common case), we could avoid the conversion and use the original string directly.

Now we check if the string's characters need encoding before converting them to bytes. When encoding is not needed (the common case), we skip the conversion from string to UTF-8 bytes.

Benchmarks

With allowed characters only (no percent-encoding required)
Method Runtime ItemCount Mean Error StdDev Ratio Gen0 Allocated Alloc Ratio
Before .NET 6.0 1 91.63 ns 0.309 ns 0.289 ns 1.00 0.0050 64 B 1.00
After .NET 6.0 1 49.84 ns 0.162 ns 0.152 ns 0.54 0.0025 32 B 0.50
Before .NET Framework 4.6.1 1 253.30 ns 1.867 ns 1.655 ns 1.00 0.0215 136 B 1.00
After .NET Framework 4.6.1 1 101.09 ns 0.368 ns 0.326 ns 0.40 0.0063 40 B 0.29
Before .NET 6.0 5 343.57 ns 1.953 ns 1.731 ns 1.00 0.0215 272 B 1.00
After .NET 6.0 5 139.36 ns 2.696 ns 3.104 ns 0.41 0.0062 80 B 0.29
Before .NET Framework 4.6.1 5 1,303.19 ns 6.138 ns 5.742 ns 1.00 0.1602 1019 B 1.00
After .NET Framework 4.6.1 5 328.44 ns 0.956 ns 0.848 ns 0.25 0.0138 88 B 0.09
With characters that require percent-encoding (whitespace and Unicode)
Method Runtime ItemCount Mean Error StdDev Ratio Gen0 Allocated Alloc Ratio
Before .NET 6.0 1 229.4 ns 2.07 ns 1.73 ns 1.00 0.0815 1024 B 1.00
After .NET 6.0 1 105.5 ns 0.76 ns 0.71 ns 0.46 0.0063 80 B 0.08
Before .NET Framework 4.6.1 1 990.2 ns 2.04 ns 1.60 ns 1.00 0.4215 2656 B 1.00
After .NET Framework 4.6.1 1 279.9 ns 1.46 ns 1.37 ns 0.28 0.0124 80 B 0.03
Before .NET 6.0 5 989.9 ns 6.25 ns 5.22 ns 1.00 0.1469 1848 B 1.00
After .NET 6.0 5 438.5 ns 4.18 ns 3.91 ns 0.44 0.0234 296 B 0.16
Before .NET Framework 4.6.1 5 4,989.7 ns 50.79 ns 45.02 ns 1.00 1.6556 10447 B 1.00
After .NET Framework 4.6.1 5 1,243.1 ns 7.70 ns 7.20 ns 0.25 0.0458 297 B 0.03

Test coverage

All W3CBaggagePropagatorTests are passing.

Other details

Follow-up from #6158.

@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Nov 8, 2024

Datadog Report

Branch report: lpimentel/baggage-cleanup
Commit report: 7932f45
Test service: dd-trace-dotnet

❌ 1 Failed (1 Known Flaky), 367888 Passed, 2082 Skipped, 14h 10m 26.9s Total Time

❌ Failed Tests (1)

  • WorkingWithContinuousProfiler - Datadog.Trace.Tools.dd_dotnet.ArtifactTests.Checks.ProcessBasicChecksTests - ❄️ Known flaky - Details

    Expand for error
     
     
     With StandardOutput:
     Running checks on process 5192 Process name: Samples.Console  ---- STARTING TRACER SETUP CHECKS ----- Target process is running with .NET Framework 1. Checking Modules Needed so the Tracer Loads:  [SUCCESS]: The native library version 3.6.0.0 is loaded into the process.  [WARNING]: Found multiple instances of Datadog.Trace.dll in the target process. Detected versions: 3.6.0.0  2. Checking DD_DOTNET_TRACER_HOME and related configuration value:  [SUCCESS]: DD_DOTNET_TRACER_HOME is set to 'D:\a\1\s\shared\bin\monitoring-home' and the directory was found correctly. 3. Checking COR_PROFILER_PATH and related configuration value:  [SUCCESS]: The environment variable COR_PROFILER_PATH is set to the correct value of D:\a\1\s\shared\bin\monitoring-home\win-x64\Datadog.Trace.ClrProfiler.Native.dll . 4. Checking COR_PROFILER and related configuration value:  [SUCCESS]: The environment variable COR_PROFILER is set to the correct value of {846F5F1C-F9AE-4B07-969E-05C26BC060D8}. 5. Checking COR_ENABLE_PROFILING and related configuration value:  [SUCCESS]: The environment variable COR_ENABLE_PROFILING is set to the correct value of 1.  ---- CONFIGURATION CHECKS ----- 1. Checking if tracing is disabled using DD_TRACE_ENABLED.  [INFO]: DD_TRACE_ENABLED is not set, the default value is true. 2. Checking if profiling is enabled using DD_PROFILING_ENABLED.  [SUCCESS]: DD_PROFILING_ENABLED is set.  ---- DATADOG AGENT CHECKS ----- Detected agent url: http://127.0.0.1:53768/. Note: this url may be incorrect if you configured the application through a configuration file. Connecting to Agent at endpoint http://127.0.0.1:53768/ using HTTP  [WARNING]: Could not detect the agent version. It may be running with a version older than 7.27.0.  [SUCCESS]: No issue found with the target process. 
     With ErrorOutput:
     
     With ExitCode:
     0acer version 3.6.0.0 is loaded into the process."}.
    

@andrewlock
Copy link
Member

andrewlock commented Nov 8, 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 (6266) - mean (70ms)  : 67, 72
     .   : milestone, 70,
    master - mean (70ms)  : 68, 72
     .   : milestone, 70,

    section CallTarget+Inlining+NGEN
    This PR (6266) - mean (1,114ms)  : 1094, 1134
     .   : milestone, 1114,
    master - mean (1,114ms)  : 1097, 1130
     .   : milestone, 1114,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6266) - mean (108ms)  : 106, 110
     .   : milestone, 108,
    master - mean (108ms)  : 105, 110
     .   : milestone, 108,

    section CallTarget+Inlining+NGEN
    This PR (6266) - mean (771ms)  : 758, 783
     .   : milestone, 771,
    master - mean (775ms)  : 762, 788
     .   : milestone, 775,

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

    section CallTarget+Inlining+NGEN
    This PR (6266) - mean (731ms)  : 717, 744
     .   : milestone, 731,
    master - mean (732ms)  : 712, 751
     .   : milestone, 732,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6266) - mean (190ms)  : 187, 193
     .   : milestone, 190,
    master - mean (190ms)  : 186, 193
     .   : milestone, 190,

    section CallTarget+Inlining+NGEN
    This PR (6266) - mean (1,229ms)  : 1206, 1253
     .   : milestone, 1229,
    master - mean (1,229ms)  : 1202, 1256
     .   : milestone, 1229,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6266) - mean (276ms)  : 270, 281
     .   : milestone, 276,
    master - mean (277ms)  : 272, 282
     .   : milestone, 277,

    section CallTarget+Inlining+NGEN
    This PR (6266) - mean (948ms)  : 932, 964
     .   : milestone, 948,
    master - mean (954ms)  : 937, 970
     .   : milestone, 954,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6266) - mean (266ms)  : 262, 270
     .   : milestone, 266,
    master - mean (263ms)  : 259, 268
     .   : milestone, 263,

    section CallTarget+Inlining+NGEN
    This PR (6266) - mean (939ms)  : 918, 959
     .   : milestone, 939,
    master - mean (934ms)  : 914, 954
     .   : milestone, 934,

Loading

@andrewlock
Copy link
Member

andrewlock commented Nov 9, 2024

Benchmarks Report for tracer 🐌

Benchmarks for #6266 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.05μs 43.6ns 235ns 0.0158 0.00792 0 5.61 KB
master StartStopWithChild netcoreapp3.1 10.1μs 54.9ns 296ns 0.021 0.0105 0 5.8 KB
master StartStopWithChild net472 16.4μs 43.9ns 170ns 1.03 0.303 0.0901 6.22 KB
#6266 StartStopWithChild net6.0 8.05μs 45.7ns 317ns 0.0157 0.00784 0 5.61 KB
#6266 StartStopWithChild netcoreapp3.1 10.2μs 57.1ns 365ns 0.0147 0.00492 0 5.8 KB
#6266 StartStopWithChild net472 16.6μs 59.8ns 232ns 1.03 0.309 0.0917 6.21 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 486μs 222ns 799ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 646μs 247ns 955ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 843μs 580ns 2.25μs 0.419 0 0 3.3 KB
#6266 WriteAndFlushEnrichedTraces net6.0 468μs 306ns 1.18μs 0 0 0 2.7 KB
#6266 WriteAndFlushEnrichedTraces netcoreapp3.1 634μs 259ns 1μs 0 0 0 2.7 KB
#6266 WriteAndFlushEnrichedTraces net472 843μs 748ns 2.8μs 0.419 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 198μs 1.16μs 10.9μs 0.2 0 0 18.73 KB
master SendRequest netcoreapp3.1 229μs 1.42μs 14μs 0.206 0 0 20.89 KB
master SendRequest net472 8.3E‑05ns 6.89E‑05ns 0.000248ns 0 0 0 0 b
#6266 SendRequest net6.0 198μs 1.14μs 9.65μs 0.193 0 0 18.73 KB
#6266 SendRequest netcoreapp3.1 216μs 1.17μs 6.73μs 0.213 0 0 20.89 KB
#6266 SendRequest net472 0.00241ns 0.00045ns 0.00162ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #6266

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 41.82 KB 41.46 KB -362 B -0.87%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 602μs 3.43μs 30.9μs 0.558 0 0 41.82 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 676μs 3.26μs 12.6μs 0.349 0 0 41.78 KB
master WriteAndFlushEnrichedTraces net472 867μs 3.74μs 14.5μs 8.25 2.6 0.434 53.27 KB
#6266 WriteAndFlushEnrichedTraces net6.0 554μs 2.45μs 9.17μs 0.553 0 0 41.46 KB
#6266 WriteAndFlushEnrichedTraces netcoreapp3.1 670μs 2.04μs 7.9μs 0.338 0 0 41.83 KB
#6266 WriteAndFlushEnrichedTraces net472 888μs 2.44μs 9.11μs 8.5 2.55 0.425 53.32 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.23μs 1.52ns 5.87ns 0.0145 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.77μs 0.875ns 3.27ns 0.0133 0 0 1.02 KB
master ExecuteNonQuery net472 2.11μs 1.33ns 4.97ns 0.156 0.00106 0 987 B
#6266 ExecuteNonQuery net6.0 1.3μs 1.04ns 4.04ns 0.0141 0 0 1.02 KB
#6266 ExecuteNonQuery netcoreapp3.1 1.78μs 1.55ns 5.99ns 0.0141 0 0 1.02 KB
#6266 ExecuteNonQuery net472 2.09μs 1.76ns 6.34ns 0.157 0.00104 0 987 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.23μs 0.403ns 1.51ns 0.0136 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.55μs 0.864ns 3.35ns 0.0131 0 0 976 B
master CallElasticsearch net472 2.48μs 2.6ns 10.1ns 0.157 0 0 995 B
master CallElasticsearchAsync net6.0 1.24μs 0.543ns 2.1ns 0.013 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.6μs 0.683ns 2.55ns 0.0137 0 0 1.02 KB
master CallElasticsearchAsync net472 2.61μs 2.81ns 10.9ns 0.167 0 0 1.05 KB
#6266 CallElasticsearch net6.0 1.16μs 0.916ns 3.3ns 0.0134 0 0 976 B
#6266 CallElasticsearch netcoreapp3.1 1.52μs 0.423ns 1.53ns 0.0128 0 0 976 B
#6266 CallElasticsearch net472 2.5μs 0.997ns 3.86ns 0.158 0 0 995 B
#6266 CallElasticsearchAsync net6.0 1.32μs 0.707ns 2.74ns 0.0132 0 0 952 B
#6266 CallElasticsearchAsync netcoreapp3.1 1.61μs 0.724ns 2.8ns 0.0145 0 0 1.02 KB
#6266 CallElasticsearchAsync net472 2.52μs 0.978ns 3.79ns 0.167 0 0 1.05 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.29μs 0.685ns 2.56ns 0.0135 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.67μs 1.73ns 6.47ns 0.0125 0 0 952 B
master ExecuteAsync net472 1.84μs 0.699ns 2.61ns 0.145 0 0 915 B
#6266 ExecuteAsync net6.0 1.29μs 0.575ns 2.15ns 0.013 0 0 952 B
#6266 ExecuteAsync netcoreapp3.1 1.68μs 1.04ns 4.02ns 0.0125 0 0 952 B
#6266 ExecuteAsync net472 1.7μs 0.323ns 1.21ns 0.145 0 0 915 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.46μs 1.22ns 4.57ns 0.0313 0 0 2.31 KB
master SendAsync netcoreapp3.1 5.2μs 1.63ns 6.3ns 0.039 0 0 2.85 KB
master SendAsync net472 7.52μs 2.64ns 10.2ns 0.495 0 0 3.12 KB
#6266 SendAsync net6.0 4.45μs 3.51ns 13.1ns 0.0309 0 0 2.31 KB
#6266 SendAsync netcoreapp3.1 5.1μs 2.27ns 8.2ns 0.0383 0 0 2.85 KB
#6266 SendAsync net472 7.35μs 1.5ns 5.4ns 0.493 0 0 3.12 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.48μs 1ns 3.76ns 0.0231 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.32μs 1.88ns 7.05ns 0.022 0 0 1.64 KB
master EnrichedLog net472 2.64μs 2ns 7.74ns 0.249 0 0 1.57 KB
#6266 EnrichedLog net6.0 1.49μs 1.5ns 5.62ns 0.0227 0 0 1.64 KB
#6266 EnrichedLog netcoreapp3.1 2.11μs 1.9ns 7.34ns 0.022 0 0 1.64 KB
#6266 EnrichedLog net472 2.63μs 0.82ns 2.96ns 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 119μs 95.3ns 369ns 0.0594 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 122μs 175ns 632ns 0 0 0 4.28 KB
master EnrichedLog net472 154μs 177ns 685ns 0.688 0.229 0 4.46 KB
#6266 EnrichedLog net6.0 120μs 295ns 1.14μs 0.0601 0 0 4.28 KB
#6266 EnrichedLog netcoreapp3.1 121μs 219ns 850ns 0 0 0 4.28 KB
#6266 EnrichedLog net472 154μs 220ns 853ns 0.688 0.229 0 4.46 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.04μs 13.8ns 55.2ns 0.0302 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.23μs 3.92ns 15.2ns 0.0295 0 0 2.2 KB
master EnrichedLog net472 4.91μs 1.62ns 6.27ns 0.32 0 0 2.02 KB
#6266 EnrichedLog net6.0 2.88μs 0.827ns 3.09ns 0.0301 0 0 2.2 KB
#6266 EnrichedLog netcoreapp3.1 4.14μs 3.48ns 13.5ns 0.0289 0 0 2.2 KB
#6266 EnrichedLog net472 4.9μs 0.943ns 3.53ns 0.32 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.45μs 0.771ns 2.99ns 0.0159 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.78μs 0.775ns 3ns 0.0151 0 0 1.14 KB
master SendReceive net472 2.17μs 4.16ns 16.1ns 0.183 0 0 1.16 KB
#6266 SendReceive net6.0 1.36μs 1.05ns 4.06ns 0.0163 0 0 1.14 KB
#6266 SendReceive netcoreapp3.1 1.81μs 1.62ns 6.29ns 0.0153 0 0 1.14 KB
#6266 SendReceive net472 2.18μs 2.62ns 10.2ns 0.183 0 0 1.16 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.8μs 1.58ns 5.9ns 0.0224 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 3.9μs 2.96ns 11.5ns 0.0214 0 0 1.65 KB
master EnrichedLog net472 4.39μs 2.57ns 9.96ns 0.323 0 0 2.04 KB
#6266 EnrichedLog net6.0 2.73μs 0.846ns 3.28ns 0.0221 0 0 1.6 KB
#6266 EnrichedLog netcoreapp3.1 3.76μs 1.81ns 7.01ns 0.0207 0 0 1.65 KB
#6266 EnrichedLog net472 4.39μs 1.31ns 4.89ns 0.323 0 0 2.04 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 406ns 0.284ns 1.1ns 0.00803 0 0 576 B
master StartFinishSpan netcoreapp3.1 640ns 0.846ns 3.28ns 0.00779 0 0 576 B
master StartFinishSpan net472 733ns 0.76ns 2.63ns 0.0916 0 0 578 B
master StartFinishScope net6.0 492ns 0.575ns 2.07ns 0.00976 0 0 696 B
master StartFinishScope netcoreapp3.1 736ns 0.596ns 2.31ns 0.00911 0 0 696 B
master StartFinishScope net472 873ns 1.52ns 5.48ns 0.104 0 0 658 B
#6266 StartFinishSpan net6.0 400ns 0.141ns 0.509ns 0.00801 0 0 576 B
#6266 StartFinishSpan netcoreapp3.1 585ns 0.628ns 2.43ns 0.00755 0 0 576 B
#6266 StartFinishSpan net472 712ns 0.204ns 0.79ns 0.0916 0 0 578 B
#6266 StartFinishScope net6.0 488ns 0.231ns 0.894ns 0.00985 0 0 696 B
#6266 StartFinishScope netcoreapp3.1 753ns 1.42ns 5.33ns 0.00939 0 0 696 B
#6266 StartFinishScope net472 907ns 0.355ns 1.38ns 0.104 0 0 658 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 600ns 0.444ns 1.72ns 0.00965 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 954ns 1.8ns 6.98ns 0.00911 0 0 696 B
master RunOnMethodBegin net472 1.12μs 0.714ns 2.76ns 0.104 0 0 658 B
#6266 RunOnMethodBegin net6.0 596ns 0.312ns 1.21ns 0.00987 0 0 696 B
#6266 RunOnMethodBegin netcoreapp3.1 932ns 0.283ns 1.06ns 0.00943 0 0 696 B
#6266 RunOnMethodBegin net472 1.16μs 0.429ns 1.66ns 0.104 0 0 658 B

@andrewlock
Copy link
Member

andrewlock commented Nov 9, 2024

Throughput/Crank Report ⚡

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 (6266) (10.976M)   : 0, 10976437
    master (11.114M)   : 0, 11114066
    benchmarks/2.9.0 (11.033M)   : 0, 11032866

    section Automatic
    This PR (6266) (7.092M)   : 0, 7091776
    master (7.233M)   : 0, 7232575
    benchmarks/2.9.0 (7.786M)   : 0, 7785853

    section Trace stats
    master (7.493M)   : 0, 7493020

    section Manual
    master (10.881M)   : 0, 10881078

    section Manual + Automatic
    This PR (6266) (6.491M)   : 0, 6491000
    master (6.542M)   : 0, 6542224

    section DD_TRACE_ENABLED=0
    master (10.339M)   : 0, 10339304

Loading
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6266) (9.505M)   : 0, 9505238
    master (9.350M)   : 0, 9349696
    benchmarks/2.9.0 (9.495M)   : 0, 9494821

    section Automatic
    This PR (6266) (6.364M)   : 0, 6363801
    master (6.299M)   : 0, 6299169

    section Trace stats
    master (6.519M)   : 0, 6519254

    section Manual
    master (9.686M)   : 0, 9685912

    section Manual + Automatic
    This PR (6266) (5.964M)   : 0, 5964289
    master (6.024M)   : 0, 6023599

    section DD_TRACE_ENABLED=0
    master (8.947M)   : 0, 8946801

Loading
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6266) (9.873M)   : 0, 9872584
    master (9.845M)   : 0, 9844694
    benchmarks/2.9.0 (10.020M)   : 0, 10019592

    section Automatic
    This PR (6266) (6.402M)   : 0, 6402153
    master (6.255M)   : 0, 6255151
    benchmarks/2.9.0 (7.255M)   : 0, 7255257

    section Trace stats
    master (6.988M)   : 0, 6988095

    section Manual
    master (10.029M)   : 0, 10029454

    section Manual + Automatic
    This PR (6266) (5.904M)   : 0, 5903947
    master (5.901M)   : 0, 5901061

    section DD_TRACE_ENABLED=0
    master (9.102M)   : 0, 9101760

Loading

@lucaspimentel lucaspimentel marked this pull request as ready for review November 11, 2024 17:45
@lucaspimentel lucaspimentel requested a review from a team as a code owner November 11, 2024 17:45
@lucaspimentel lucaspimentel added the type:performance Performance, speed, latency, resource usage (CPU, memory) label Nov 11, 2024
@lucaspimentel lucaspimentel requested a review from a team November 11, 2024 23:07
Copy link
Member

@andrewlock andrewlock left a comment

Choose a reason for hiding this comment

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

Nice results! Didn't entirely follow the changes tbh, but this is a case of "if you have tests for it all, I'm happy" 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:performance Performance, speed, latency, resource usage (CPU, memory)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants