Don't use global statics where possible#7939
Merged
andrewlock merged 2 commits intomasterfrom Dec 17, 2025
Merged
Conversation
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (7939) and master. ✅ No regressions detected - check the details below Full Metrics ComparisonFakeDbCommand
HttpMessageHandler
Comparison explanationExecution-time benchmarks measure the whole time it takes to execute a program, and are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are highlighted in **red**. The following thresholds were used for comparing the execution times:
Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard. Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph). Duration chartsFakeDbCommand (.NET Framework 4.8)gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7939) - mean (74ms) : 68, 80
master - mean (75ms) : 70, 80
section Bailout
This PR (7939) - mean (79ms) : 73, 85
master - mean (79ms) : 74, 84
section CallTarget+Inlining+NGEN
This PR (7939) - mean (1,069ms) : 1004, 1133
master - mean (1,064ms) : 1014, 1114
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 (7939) - mean (116ms) : 110, 123
master - mean (116ms) : 110, 122
section Bailout
This PR (7939) - mean (118ms) : 112, 125
master - mean (119ms) : 112, 125
section CallTarget+Inlining+NGEN
This PR (7939) - mean (765ms) : 723, 807
master - mean (760ms) : 722, 799
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7939) - mean (104ms) : 97, 112
master - mean (103ms) : 97, 109
section Bailout
This PR (7939) - mean (104ms) : 98, 109
master - mean (104ms) : 98, 110
section CallTarget+Inlining+NGEN
This PR (7939) - mean (706ms) : 667, 745
master - mean (702ms) : 675, 729
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7939) - mean (103ms) : 95, 112
master - mean (101ms) : 94, 109
section Bailout
This PR (7939) - mean (105ms) : 97, 112
master - mean (103ms) : 98, 109
section CallTarget+Inlining+NGEN
This PR (7939) - mean (673ms) : 643, 702
master - mean (666ms) : 643, 689
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 (7939) - mean (196ms) : 191, 201
master - mean (195ms) : 189, 201
section Bailout
This PR (7939) - mean (199ms) : 195, 204
master - mean (199ms) : 195, 204
section CallTarget+Inlining+NGEN
This PR (7939) - mean (1,129ms) : 1068, 1190
master - mean (1,133ms) : 1058, 1208
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 (7939) - mean (280ms) : 270, 290
master - mean (279ms) : 272, 286
section Bailout
This PR (7939) - mean (280ms) : 273, 287
master - mean (281ms) : 273, 290
section CallTarget+Inlining+NGEN
This PR (7939) - mean (914ms) : 867, 962
master - mean (916ms) : 868, 965
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7939) - mean (273ms) : 264, 282
master - mean (274ms) : 265, 282
section Bailout
This PR (7939) - mean (272ms) : 267, 278
master - mean (273ms) : 267, 279
section CallTarget+Inlining+NGEN
This PR (7939) - mean (891ms) : 852, 930
master - mean (898ms) : 853, 943
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7939) - mean (272ms) : 265, 279
master - mean (273ms) : 266, 280
section Bailout
This PR (7939) - mean (274ms) : 265, 283
master - mean (271ms) : 266, 276
section CallTarget+Inlining+NGEN
This PR (7939) - mean (833ms) : 813, 852
master - mean (833ms) : 811, 855
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
lucaspimentel
approved these changes
Dec 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of changes
Iastinstance in favour of using staticIast.Iast.InstanceReason for change
In
AspNetCoreDiagnosticObserver, we explicitly pass in anIastinstance, primarily for testing purposes, but then we're "accidentally" accessing the static instance in the pipeline helper, defeating the purpose for testingImplementation details
Iastwhere possible instead of accessing global state?to property which can (and sometimes will) benullTest coverage
Covered by existing
Other details
Noticed while working on other things