Reduce allocation in ExposureApi by serializing to stream#8051
Reduce allocation in ExposureApi by serializing to stream#8051andrewlock merged 2 commits intomasterfrom
ExposureApi by serializing to stream#8051Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d8826bd8ef
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
BenchmarksBenchmark execution time: 2026-01-13 12:00:58 Comparing candidate commit c4cd4b3 in PR branch Found 4 performance improvements and 4 performance regressions! Performance is the same for 168 metrics, 10 unstable metrics. scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1
scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody netcoreapp3.1
scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472
scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1
scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net6.0
scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope netcoreapp3.1
scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1
|
|
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (8051) 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 (8051) - mean (68ms) : 67, 70
master - mean (68ms) : 67, 70
section Bailout
This PR (8051) - mean (72ms) : 71, 73
master - mean (72ms) : 71, 73
section CallTarget+Inlining+NGEN
This PR (8051) - mean (1,007ms) : 965, 1049
master - mean (1,007ms) : 970, 1044
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 (8051) - mean (106ms) : 103, 108
master - mean (106ms) : 103, 109
section Bailout
This PR (8051) - mean (107ms) : 106, 108
master - mean (107ms) : 106, 108
section CallTarget+Inlining+NGEN
This PR (8051) - mean (742ms) : 671, 813
master - mean (735ms) : 681, 789
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8051) - mean (96ms) : 92, 99
master - mean (93ms) : 91, 95
section Bailout
This PR (8051) - mean (97ms) : 94, 99
master - mean (94ms) : 93, 95
section CallTarget+Inlining+NGEN
This PR (8051) - mean (707ms) : 656, 758
master - mean (708ms) : 672, 745
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8051) - mean (96ms) : 92, 99
master - mean (92ms) : 90, 94
section Bailout
This PR (8051) - mean (97ms) : 95, 99
master - mean (92ms) : 91, 93
section CallTarget+Inlining+NGEN
This PR (8051) - mean (650ms) : 630, 669
master - mean (632ms) : 619, 645
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 (8051) - mean (193ms) : 188, 198
master - mean (193ms) : 189, 197
section Bailout
This PR (8051) - mean (197ms) : 194, 199
master - mean (196ms) : 193, 199
section CallTarget+Inlining+NGEN
This PR (8051) - mean (1,114ms) : 1063, 1165
master - mean (1,130ms) : 1049, 1211
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 (8051) - mean (277ms) : 270, 284
master - mean (276ms) : 271, 281
section Bailout
This PR (8051) - mean (276ms) : 272, 280
master - mean (276ms) : 273, 279
section CallTarget+Inlining+NGEN
This PR (8051) - mean (926ms) : 873, 978
master - mean (924ms) : 871, 976
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8051) - mean (269ms) : 264, 275
master - mean (269ms) : 265, 273
section Bailout
This PR (8051) - mean (269ms) : 266, 273
master - mean (269ms) : 265, 273
section CallTarget+Inlining+NGEN
This PR (8051) - mean (929ms) : 897, 961
master - mean (926ms) : 882, 970
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8051) - mean (272ms) : 261, 282
master - mean (275ms) : 268, 281
section Bailout
This PR (8051) - mean (270ms) : 265, 275
master - mean (268ms) : 265, 272
section CallTarget+Inlining+NGEN
This PR (8051) - mean (826ms) : 808, 843
master - mean (823ms) : 805, 842
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Summary of changes
Use the new
PostAsJsonAsyncAPI to avoid serializing to string and byte array locallyReason for change
We recently added support for
PostAsJsonAsyncin #8017, and this is a good example where we can easily swap it in in the new Exposures API used by FFE: #7896Implementation details
Just updated to use the new APIs. A couple of points to notice:
SerializationHelpers.DefaultJsonSettings, which omits serializing null members, and uses snake-case serialization, instead of the PascalCase we have currentlyTest coverage
This should be covered by existing tests... and if it's not, then we need to add those tests 😄