Use IArrayPool in more places for JSON#8236
Conversation
7585dbf to
01f5961
Compare
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (8236) 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 (8236) - mean (77ms) : 75, 79
master - mean (77ms) : 75, 80
section Bailout
This PR (8236) - mean (83ms) : 81, 85
master - mean (82ms) : 80, 85
section CallTarget+Inlining+NGEN
This PR (8236) - mean (1,107ms) : 1059, 1155
master - mean (1,105ms) : 1060, 1151
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 (8236) - mean (120ms) : 116, 124
master - mean (121ms) : 117, 124
section Bailout
This PR (8236) - mean (121ms) : 118, 124
master - mean (123ms) : 120, 125
section CallTarget+Inlining+NGEN
This PR (8236) - mean (786ms) : 721, 851
master - mean (796ms) : 732, 859
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8236) - mean (108ms) : 104, 111
master - mean (107ms) : 103, 111
section Bailout
This PR (8236) - mean (109ms) : 106, 112
master - mean (109ms) : 105, 112
section CallTarget+Inlining+NGEN
This PR (8236) - mean (768ms) : 687, 849
master - mean (773ms) : 703, 843
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8236) - mean (106ms) : 103, 109
master - mean (105ms) : 103, 108
section Bailout
This PR (8236) - mean (108ms) : 106, 110
master - mean (107ms) : 104, 110
section CallTarget+Inlining+NGEN
This PR (8236) - mean (703ms) : 674, 732
master - mean (699ms) : 674, 724
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 (8236) - mean (196ms) : 192, 201
master - mean (198ms) : 192, 205
section Bailout
This PR (8236) - mean (200ms) : 197, 203
master - mean (203ms) : 198, 208
section CallTarget+Inlining+NGEN
This PR (8236) - mean (1,166ms) : 1114, 1218
master - mean (1,172ms) : 1113, 1230
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 (8236) - mean (283ms) : 276, 291
master - mean (282ms) : 275, 289
section Bailout
This PR (8236) - mean (284ms) : 277, 291
master - mean (285ms) : 278, 292
section CallTarget+Inlining+NGEN
This PR (8236) - mean (959ms) : 921, 997
master - mean (953ms) : 912, 994
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8236) - mean (275ms) : 268, 282
master - mean (277ms) : 270, 284
section Bailout
This PR (8236) - mean (275ms) : 268, 282
master - mean (279ms) : 272, 286
section CallTarget+Inlining+NGEN
This PR (8236) - mean (945ms) : 915, 975
master - mean (945ms) : 909, 981
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8236) - mean (274ms) : 266, 281
master - mean (273ms) : 269, 278
section Bailout
This PR (8236) - mean (274ms) : 269, 279
master - mean (278ms) : 271, 286
section CallTarget+Inlining+NGEN
This PR (8236) - mean (844ms) : 818, 871
master - mean (848ms) : 826, 871
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
BenchmarksBenchmark execution time: 2026-03-09 18:29:28 Comparing candidate commit c42342d in PR branch Found 8 performance improvements and 6 performance regressions! Performance is the same for 164 metrics, 14 unstable metrics. scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net6.0
scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody netcoreapp3.1
scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net472
scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472
scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net6.0
scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1
scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1
scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync netcoreapp3.1
scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog netcoreapp3.1
scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net6.0
scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore netcoreapp3.1
scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope netcoreapp3.1
scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net6.0
|
dd07383 to
a33aae2
Compare
01f5961 to
c42342d
Compare
## Summary of changes Adds JSON helper APIs to ensure we use the array pool where possible ## Reason for change There are various "helper" APIs, which are wrappers around Newtonsoft.JSON's `JsonSerializer` and `JsonReader`/`JsonWriter` APIs. In #8228 we updated the explicit usages to use an array pool implementation for `JsonReader`/`JsonWriter` calls, but they're used internally without a pool in the helper cases. This PR creates alternative implementations which _do_ use the pool, updates existing code to use them, and adds the existing APIs to the "banned API" list. > There's another possible approach, in which we update the vendored code to _always_ use the array pool. I was torn as to which is the better option, and went for this approach in the end, but I'm not wedded to it, so happy to take the alternative approach if people think it's preferable? ## Implementation details - Use 🤖 to find all the potential places that we need to convert. - Create "array pool" versions of the APIs - Update the call sites to use the new APIs - Add the original APIs to the list of "banned" APIs to avoid using them accidentally in the future ## Test coverage Covered by all our existing tests, added some unit tests to confirm the new tests behave as expected ## Other details https://datadoghq.atlassian.net/browse/LANGPLAT-940 Discovered this while exploring remote config optimizations, but should help lots of areas.
Summary of changes
Adds JSON helper APIs to ensure we use the array pool where possible
Reason for change
There are various "helper" APIs, which are wrappers around Newtonsoft.JSON's
JsonSerializerandJsonReader/JsonWriterAPIs. In #8228 we updated the explicit usages to use an array pool implementation forJsonReader/JsonWritercalls, but they're used internally without a pool in the helper cases.This PR creates alternative implementations which do use the pool, updates existing code to use them, and adds the existing APIs to the "banned API" list.
Implementation details
Test coverage
Covered by all our existing tests, added some unit tests to confirm the new tests behave as expected
Other details
https://datadoghq.atlassian.net/browse/LANGPLAT-940
Discovered this while exploring remote config optimizations, but should help lots of areas.