Prevent invalid JSON in AWS Lambda payloads#8662
Conversation
BenchmarksBenchmark execution time: 2026-05-20 10:40:25 Comparing candidate commit f35a67b in PR branch Some scenarios are present only in baseline or only in candidate runs. If you didn't create or remove some scenarios in your branch, this maybe a sign of crashed benchmarks 💥💥💥 Scenarios present only in baseline:
Found 3 performance improvements and 4 performance regressions! Performance is the same for 49 metrics, 16 unstable metrics, 84 known flaky benchmarks, 42 flaky benchmarks without significant changes.
|
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (8662) 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 (8662) - mean (74ms) : 70, 78
master - mean (73ms) : 70, 75
section Bailout
This PR (8662) - mean (77ms) : 75, 80
master - mean (77ms) : 74, 79
section CallTarget+Inlining+NGEN
This PR (8662) - mean (1,111ms) : 1069, 1154
master - mean (1,110ms) : 1059, 1161
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 (8662) - mean (115ms) : 110, 120
master - mean (113ms) : 109, 117
section Bailout
This PR (8662) - mean (116ms) : 113, 118
master - mean (118ms) : 112, 124
section CallTarget+Inlining+NGEN
This PR (8662) - mean (797ms) : 774, 819
master - mean (788ms) : 764, 812
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8662) - mean (101ms) : 98, 104
master - mean (104ms) : 98, 110
section Bailout
This PR (8662) - mean (105ms) : 100, 111
master - mean (102ms) : 99, 105
section CallTarget+Inlining+NGEN
This PR (8662) - mean (949ms) : 916, 982
master - mean (946ms) : 908, 984
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8662) - mean (100ms) : 96, 104
master - mean (100ms) : 96, 103
section Bailout
This PR (8662) - mean (101ms) : 98, 104
master - mean (104ms) : 99, 108
section CallTarget+Inlining+NGEN
This PR (8662) - mean (826ms) : 784, 869
master - mean (823ms) : 789, 856
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 (8662) - mean (201ms) : 196, 207
master - mean (201ms) : 195, 206
section Bailout
This PR (8662) - mean (205ms) : 200, 210
master - mean (205ms) : 198, 211
section CallTarget+Inlining+NGEN
This PR (8662) - mean (1,210ms) : 1156, 1263
master - mean (1,203ms) : 1156, 1250
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 (8662) - mean (289ms) : 282, 296
master - mean (289ms) : 282, 297
section Bailout
This PR (8662) - mean (289ms) : 280, 299
master - mean (289ms) : 280, 298
section CallTarget+Inlining+NGEN
This PR (8662) - mean (971ms) : 953, 989
master - mean (965ms) : 947, 983
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8662) - mean (281ms) : 274, 289
master - mean (279ms) : 267, 291
section Bailout
This PR (8662) - mean (283ms) : 274, 291
master - mean (281ms) : 274, 288
section CallTarget+Inlining+NGEN
This PR (8662) - mean (1,162ms) : 1126, 1199
master - mean (1,156ms) : 1121, 1191
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8662) - mean (281ms) : 275, 286
master - mean (278ms) : 270, 286
section Bailout
This PR (8662) - mean (280ms) : 273, 287
master - mean (280ms) : 273, 286
section CallTarget+Inlining+NGEN
This PR (8662) - mean (1,041ms) : 996, 1086
master - mean (1,038ms) : 1001, 1075
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Summary of changes
stringfor inclusion in JSONStringBuilderto avoid allocationReason for change
The serverless context injection has to modify JSON to add additional headers. It's currently doing that using a
StringBuilderapproach, but it's not currently accounting for any potential characters in the injected payloads that might need escaping. This is rare and unlikely, but theoretically possible.Additionally, there's some inefficiencies in how the
StringBuilderis used in some cases, which is doing more allocation than necessary (e.g. using multipleStringBuilders, using interpolation, usingAppendFormat)Implementation details
JsonHelper.WriteEscapedJavaScriptString()based on the vendoredNewtonsoft.JSonversionchar[], which the new version avoids.ContextPropagationimplementations to use itContextPropagationimplementation usages ofStringBuilderTest coverage