Skip to content

Minor aspnetcore perf improvements#8210

Merged
andrewlock merged 5 commits intomasterfrom
andrew/aspnetcore-perf/minor-improvements
Feb 18, 2026
Merged

Minor aspnetcore perf improvements#8210
andrewlock merged 5 commits intomasterfrom
andrew/aspnetcore-perf/minor-improvements

Conversation

@andrewlock
Copy link
Member

@andrewlock andrewlock commented Feb 17, 2026

Summary of changes

A few minor improvements to the standard AspNetCoreDiagnosticObserver

Reason for change

Looking into obvious perf improvements for ASP.NET Core, but only a few minor things stood out (apart from related PRs like #8199 and #8203).

Implementation details

  • Reduce size of MVC tags object by not deriving from WebTags (we never set those tags anyway)
  • Delay creating spanlinks collection if we don't need it
  • HttpRoute always matches AspNetCoreRoute, so can make it readonly

Test coverage

Covered by existing tests, benchmarks show (tiny) allocation gains

Other details

Relates to https://datadoghq.atlassian.net/browse/LANGPLAT-842

Related PRs:

@andrewlock andrewlock requested a review from a team as a code owner February 17, 2026 11:31
@andrewlock andrewlock added the area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) label Feb 17, 2026
@andrewlock andrewlock requested a review from a team as a code owner February 17, 2026 11:31
@andrewlock andrewlock added the type:performance Performance, speed, latency, resource usage (CPU, memory) label Feb 17, 2026
@dd-trace-dotnet-ci-bot
Copy link

dd-trace-dotnet-ci-bot bot commented Feb 17, 2026

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (8210) and master.

⚠️ Potential regressions detected

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration203.03 ± (202.87 - 203.75) ms225.04 ± (224.08 - 226.62) ms+10.8%❌⬆️
.NET Framework 4.8 - Bailout
duration206.24 ± (206.11 - 206.99) ms229.34 ± (228.95 - 231.09) ms+11.2%❌⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1182.81 ± (1181.42 - 1187.30) ms1255.82 ± (1253.55 - 1261.12) ms+6.2%❌⬆️
Full Metrics Comparison

FakeDbCommand

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration71.40 ± (71.35 - 71.63) ms76.30 ± (76.32 - 76.62) ms+6.9%✅⬆️
.NET Framework 4.8 - Bailout
duration76.81 ± (76.76 - 77.14) ms80.88 ± (80.79 - 81.16) ms+5.3%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1071.45 ± (1070.11 - 1076.29) ms1096.62 ± (1096.37 - 1101.78) ms+2.3%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms23.09 ± (23.04 - 23.15) ms23.48 ± (23.42 - 23.54) ms+1.7%✅⬆️
process.time_to_main_ms93.73 ± (93.50 - 93.96) ms95.95 ± (95.72 - 96.18) ms+2.4%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed15.45 ± (15.45 - 15.46) MB15.49 ± (15.48 - 15.49) MB+0.2%✅⬆️
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms23.17 ± (23.13 - 23.21) ms23.46 ± (23.38 - 23.54) ms+1.3%✅⬆️
process.time_to_main_ms96.00 ± (95.76 - 96.25) ms98.32 ± (97.97 - 98.68) ms+2.4%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed15.51 ± (15.51 - 15.52) MB15.53 ± (15.53 - 15.53) MB+0.1%✅⬆️
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms268.62 ± (266.03 - 271.20) ms275.12 ± (272.68 - 277.57) ms+2.4%✅⬆️
process.time_to_main_ms515.97 ± (515.27 - 516.67) ms529.40 ± (528.64 - 530.17) ms+2.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed52.10 ± (52.08 - 52.12) MB52.13 ± (52.11 - 52.16) MB+0.1%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.0%
.NET 6 - Baseline
process.internal_duration_ms21.83 ± (21.79 - 21.88) ms22.32 ± (22.27 - 22.37) ms+2.2%✅⬆️
process.time_to_main_ms80.71 ± (80.55 - 80.88) ms83.79 ± (83.60 - 83.98) ms+3.8%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed15.16 ± (15.16 - 15.16) MB15.17 ± (15.17 - 15.17) MB+0.0%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms21.82 ± (21.78 - 21.86) ms22.30 ± (22.25 - 22.35) ms+2.2%✅⬆️
process.time_to_main_ms82.71 ± (82.51 - 82.90) ms85.36 ± (85.15 - 85.58) ms+3.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed15.28 ± (15.27 - 15.28) MB15.28 ± (15.28 - 15.28) MB+0.0%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms267.16 ± (266.35 - 267.96) ms273.94 ± (273.12 - 274.76) ms+2.5%✅⬆️
process.time_to_main_ms489.54 ± (488.70 - 490.37) ms506.87 ± (506.05 - 507.70) ms+3.5%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed52.92 ± (52.90 - 52.95) MB52.90 ± (52.89 - 52.92) MB-0.0%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.3%
.NET 8 - Baseline
process.internal_duration_ms19.37 ± (19.33 - 19.41) ms20.23 ± (20.18 - 20.27) ms+4.4%✅⬆️
process.time_to_main_ms72.71 ± (72.54 - 72.87) ms76.39 ± (76.23 - 76.55) ms+5.1%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.65 ± (7.64 - 7.66) MB7.64 ± (7.64 - 7.64) MB-0.1%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.38 ± (19.33 - 19.43) ms20.23 ± (20.18 - 20.28) ms+4.4%✅⬆️
process.time_to_main_ms73.84 ± (73.67 - 74.01) ms77.85 ± (77.66 - 78.03) ms+5.4%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.71 ± (7.70 - 7.72) MB7.71 ± (7.70 - 7.72) MB+0.1%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms187.75 ± (186.83 - 188.67) ms192.80 ± (192.11 - 193.49) ms+2.7%✅⬆️
process.time_to_main_ms445.02 ± (444.20 - 445.85) ms465.22 ± (464.52 - 465.92) ms+4.5%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed36.00 ± (35.96 - 36.04) MB36.16 ± (36.11 - 36.20) MB+0.4%✅⬆️
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)-0.0%

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration203.03 ± (202.87 - 203.75) ms225.04 ± (224.08 - 226.62) ms+10.8%❌⬆️
.NET Framework 4.8 - Bailout
duration206.24 ± (206.11 - 206.99) ms229.34 ± (228.95 - 231.09) ms+11.2%❌⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1182.81 ± (1181.42 - 1187.30) ms1255.82 ± (1253.55 - 1261.12) ms+6.2%❌⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms201.34 ± (200.92 - 201.76) ms227.03 ± (225.77 - 228.29) ms+12.8%✅⬆️
process.time_to_main_ms93.16 ± (92.90 - 93.42) ms103.20 ± (102.77 - 103.63) ms+10.8%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed20.61 ± (20.60 - 20.63) MB20.30 ± (20.29 - 20.32) MB-1.5%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)+1.7%✅⬆️
.NET Core 3.1 - Bailout
process.internal_duration_ms201.93 ± (201.50 - 202.37) ms229.06 ± (227.96 - 230.15) ms+13.4%✅⬆️
process.time_to_main_ms94.94 ± (94.58 - 95.30) ms106.30 ± (105.83 - 106.77) ms+12.0%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed20.55 ± (20.53 - 20.57) MB20.36 ± (20.35 - 20.38) MB-0.9%
runtime.dotnet.threads.count21 ± (21 - 21)21 ± (21 - 21)+1.8%✅⬆️
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms460.10 ± (458.07 - 462.13) ms486.93 ± (483.39 - 490.46) ms+5.8%✅⬆️
process.time_to_main_ms524.59 ± (523.77 - 525.41) ms563.12 ± (561.78 - 564.46) ms+7.3%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed61.88 ± (61.75 - 62.01) MB60.74 ± (60.58 - 60.89) MB-1.8%
runtime.dotnet.threads.count29 ± (29 - 29)30 ± (30 - 30)+1.2%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms204.45 ± (203.96 - 204.94) ms225.98 ± (224.91 - 227.05) ms+10.5%✅⬆️
process.time_to_main_ms75.24 ± (74.97 - 75.51) ms81.74 ± (81.43 - 82.04) ms+8.6%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.23 ± (16.21 - 16.26) MB16.10 ± (16.08 - 16.12) MB-0.8%
runtime.dotnet.threads.count19 ± (19 - 19)20 ± (20 - 20)+1.4%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms203.25 ± (202.78 - 203.72) ms226.65 ± (225.47 - 227.82) ms+11.5%✅⬆️
process.time_to_main_ms75.78 ± (75.58 - 75.98) ms82.94 ± (82.60 - 83.29) ms+9.5%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.27 ± (16.25 - 16.29) MB16.14 ± (16.12 - 16.15) MB-0.8%
runtime.dotnet.threads.count20 ± (20 - 20)21 ± (21 - 21)+1.9%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms466.38 ± (463.91 - 468.85) ms505.63 ± (498.23 - 513.04) ms+8.4%✅⬆️
process.time_to_main_ms473.07 ± (472.39 - 473.75) ms504.94 ± (503.81 - 506.06) ms+6.7%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed57.14 ± (57.02 - 57.27) MB57.76 ± (57.60 - 57.93) MB+1.1%✅⬆️
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)+1.2%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms206.87 ± (206.43 - 207.32) ms235.73 ± (234.31 - 237.15) ms+13.9%✅⬆️
process.time_to_main_ms81.25 ± (81.01 - 81.49) ms88.58 ± (88.22 - 88.94) ms+9.0%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.11 ± (16.10 - 16.13) MB15.90 ± (15.88 - 15.92) MB-1.3%
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)-0.0%
.NET 8 - Bailout
process.internal_duration_ms206.14 ± (205.64 - 206.64) ms232.88 ± (231.59 - 234.17) ms+13.0%✅⬆️
process.time_to_main_ms82.06 ± (81.85 - 82.28) ms89.96 ± (89.61 - 90.30) ms+9.6%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.17 ± (16.15 - 16.18) MB16.01 ± (15.99 - 16.03) MB-1.0%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)+0.0%✅⬆️
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms414.65 ± (407.90 - 421.39) ms514.59 ± (512.70 - 516.48) ms+24.1%✅⬆️
process.time_to_main_ms485.34 ± (484.59 - 486.10) ms516.13 ± (514.97 - 517.28) ms+6.3%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed53.78 ± (53.62 - 53.94) MB54.27 ± (54.24 - 54.30) MB+0.9%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)-0.9%
Comparison explanation

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

Duration charts
FakeDbCommand (.NET Framework 4.8)
gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8210) - mean (76ms)  : 74, 79
    master - mean (71ms)  : 69, 74

    section Bailout
    This PR (8210) - mean (81ms)  : 79, 83
    master - mean (77ms)  : 75, 79

    section CallTarget+Inlining+NGEN
    This PR (8210) - mean (1,099ms)  : 1061, 1138
    master - mean (1,073ms)  : 1028, 1118

Loading
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 (8210) - mean (127ms)  : 123, 131
    master - mean (125ms)  : 119, 130

    section Bailout
    This PR (8210) - mean (129ms)  : 124, 135
    master - mean (127ms)  : 122, 132

    section CallTarget+Inlining+NGEN
    This PR (8210) - mean (842ms)  : 798, 885
    master - mean (814ms)  : 768, 859

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8210) - mean (113ms)  : 110, 117
    master - mean (109ms)  : 106, 113

    section Bailout
    This PR (8210) - mean (115ms)  : 112, 117
    master - mean (112ms)  : 109, 114

    section CallTarget+Inlining+NGEN
    This PR (8210) - mean (818ms)  : 787, 850
    master - mean (791ms)  : 762, 820

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8210) - mean (105ms)  : 102, 108
    master - mean (100ms)  : 97, 103

    section Bailout
    This PR (8210) - mean (106ms)  : 103, 109
    master - mean (101ms)  : 99, 103

    section CallTarget+Inlining+NGEN
    This PR (8210) - mean (690ms)  : 664, 717
    master - mean (661ms)  : 642, 680

Loading
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 (8210) - mean (225ms)  : 206, 245
    master - mean (203ms)  : 198, 209

    section Bailout
    This PR (8210) - mean (230ms)  : crit, 215, 245
    master - mean (207ms)  : 202, 211

    section CallTarget+Inlining+NGEN
    This PR (8210) - mean (1,257ms)  : crit, 1201, 1314
    master - mean (1,184ms)  : 1142, 1227

Loading
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 (8210) - mean (341ms)  : 314, 368
    master - mean (304ms)  : 295, 313

    section Bailout
    This PR (8210) - mean (347ms)  : crit, 324, 370
    master - mean (306ms)  : 299, 313

    section CallTarget+Inlining+NGEN
    This PR (8210) - mean (1,087ms)  : crit, 1027, 1147
    master - mean (1,018ms)  : 981, 1055

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8210) - mean (318ms)  : 300, 336
    master - mean (288ms)  : 279, 297

    section Bailout
    This PR (8210) - mean (319ms)  : crit, 299, 340
    master - mean (288ms)  : 278, 297

    section CallTarget+Inlining+NGEN
    This PR (8210) - mean (1,051ms)  : crit, 946, 1156
    master - mean (970ms)  : 926, 1014

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8210) - mean (337ms)  : 313, 360
    master - mean (299ms)  : 290, 308

    section Bailout
    This PR (8210) - mean (335ms)  : crit, 312, 357
    master - mean (299ms)  : 290, 308

    section CallTarget+Inlining+NGEN
    This PR (8210) - mean (1,070ms)  : crit, 1020, 1121
    master - mean (939ms)  : 832, 1045

Loading

actionName: actionName,
expandRouteParameters: tracer.Settings.ExpandRouteTemplatesEnabled);

resourceName = $"{rootSpanTags.HttpMethod} {request.PathBase.ToUriComponent()}{resourcePathName}";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
var resourceName = request.PathBase.HasValue
? $"{rootSpanTags.HttpMethod} {request.PathBase.ToUriComponent()}{resourcePathName}"
: $"{rootSpanTags.HttpMethod} {resourcePathName}";

Same as line 565

Copy link
Member Author

Choose a reason for hiding this comment

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

Haha, I literally had that exact commit originally, and removed it 😄 As the formatted components are all strings, and request.PathBase.ToUriComponent() already has if (!request.PathBase.HasValue) { return string.Empty; }, adding the extra if doesn't actually improve things 🙂

return _extractBehavior switch
{
ExtractBehavior.Restart when cumulativeSpanContext is not null => new PropagationContext(default, cumulativeBaggage, [new SpanLink(cumulativeSpanContext, attributes: [new("reason", "propagation_behavior_extract"), new("context_headers", initialExtractorDisplayName!)])]),
ExtractBehavior.Restart => new PropagationContext(default, cumulativeBaggage, []),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
ExtractBehavior.Restart => new PropagationContext(default, cumulativeBaggage, null),

Instead an empty list, could we just pass null?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, thanks! 👍 I was going to look at the propagators in a separate PR though, as there's a bunch of things we can do there I think, I'll make sure to include this 🙂

Copy link
Collaborator

@NachoEchevarria NachoEchevarria left a comment

Choose a reason for hiding this comment

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

Nice!!!

@andrewlock andrewlock force-pushed the andrew/aspnetcore-perf/minor-improvements branch from fe8e724 to fcdf117 Compare February 17, 2026 15:22
@pr-commenter
Copy link

pr-commenter bot commented Feb 17, 2026

Benchmarks

Benchmark execution time: 2026-02-17 16:04:54

Comparing candidate commit fcdf117 in PR branch andrew/aspnetcore-perf/minor-improvements with baseline commit b9628c8 in branch master.

Found 8 performance improvements and 10 performance regressions! Performance is the same for 163 metrics, 11 unstable metrics.

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • 🟥 execution_time [+27.262ms; +27.480ms] or [+27.346%; +27.564%]
  • 🟥 throughput [-47.643op/s; -46.228op/s] or [-5.937%; -5.761%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net6.0

  • 🟩 execution_time [-16.279ms; -11.857ms] or [-7.593%; -5.530%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net6.0

  • 🟩 execution_time [-30.061ms; -23.511ms] or [-13.528%; -10.580%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody netcoreapp3.1

  • 🟥 execution_time [+18.412ms; +24.629ms] or [+9.491%; +12.696%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net6.0

  • 🟥 execution_time [+17.458ms; +23.467ms] or [+8.914%; +11.983%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net6.0

  • 🟥 execution_time [+24.828ms; +25.091ms] or [+13.904%; +14.051%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net6.0

  • 🟥 execution_time [+44.636ms; +45.927ms] or [+46.773%; +48.127%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest netcoreapp3.1

  • 🟥 throughput [-1507.207op/s; -520.355op/s] or [-14.649%; -5.057%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟩 throughput [+127.623op/s; +150.646op/s] or [+12.743%; +15.042%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • 🟩 execution_time [-41.941ms; -37.989ms] or [-19.993%; -18.110%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟩 execution_time [-70.290ms; -65.715ms] or [-32.240%; -30.142%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net6.0

  • 🟩 execution_time [-139.285µs; -130.635µs] or [-9.167%; -8.598%]
  • 🟩 throughput [+62.088op/s; +66.237op/s] or [+9.434%; +10.064%]

scenario:Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery netcoreapp3.1

  • 🟩 throughput [+25970.105op/s; +37771.749op/s] or [+6.613%; +9.618%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net6.0

  • 🟥 throughput [-44163.570op/s; -33221.931op/s] or [-7.633%; -5.742%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark netcoreapp3.1

  • 🟥 throughput [-405.181op/s; -221.259op/s] or [-18.288%; -9.987%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net6.0

  • 🟥 execution_time [+23.895ms; +25.447ms] or [+25.961%; +27.647%]

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes small allocation/performance improvements in the ASP.NET Core tracing pipeline by simplifying tag objects, lazily allocating extracted span links, and tightening some types.

Changes:

  • Reduce ASP.NET Core MVC tags footprint by switching AspNetCoreMvcTags to derive from InstrumentationTags (instead of WebTags).
  • Lazily allocate the extracted SpanLink list during context extraction to avoid per-request allocations when unused.
  • Make http.route derive from aspnet_core.route (read-only alias) and update generated tag-setters accordingly.

Reviewed changes

Copilot reviewed 8 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tracer/test/Datadog.Trace.Tests/Propagators/MultiSpanContextPropagatorTests.cs Align expectations with Links now being nullable (null-or-empty).
tracer/src/Datadog.Trace/Tagging/AspNetCoreTags.cs Make HttpRoute a computed alias of AspNetCoreRoute.
tracer/src/Datadog.Trace/Tagging/AspNetCoreMvcTags.cs Switch MVC tags to InstrumentationTags + add required tags explicitly.
tracer/src/Datadog.Trace/SpanLink.cs Remove unused logger field (but leaves an unused using).
tracer/src/Datadog.Trace/Propagators/SpanContextPropagator.cs Lazy-create spanLinks; use static lambda for cache factory to avoid captures.
tracer/src/Datadog.Trace/PlatformHelpers/AspNetCoreHttpRequestHandler.cs Simplify private pipeline-scope helper signature to non-generic WebTags.
tracer/src/Datadog.Trace/Generated/*/Datadog.Trace.SourceGenerators/TagListGenerator/AspNetCoreTags.g.cs Update http.route setter behavior for read-only tag.
tracer/src/Datadog.Trace/Generated/*/Datadog.Trace.SourceGenerators/TagListGenerator/AspNetCoreMvcTags.g.cs Add serialization support for new MVC tags (span.kind, component, aspnet_core.route).
tracer/src/Datadog.Trace/DiagnosticListeners/AspNetCoreDiagnosticObserver.cs Remove explicit HttpRoute setting (now derived).
Datadog.Trace.Minimal.slnf Expand the “minimal” solution filter to include additional projects.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@andrewlock andrewlock merged commit 6ee224f into master Feb 18, 2026
148 checks passed
@andrewlock andrewlock deleted the andrew/aspnetcore-perf/minor-improvements branch February 18, 2026 09:19
@github-actions github-actions bot added this to the vNext-v3 milestone Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) type:performance Performance, speed, latency, resource usage (CPU, memory)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants