Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve NativeCallTargetDefinition marshalling #4326

Merged

Conversation

tonyredondo
Copy link
Member

@tonyredondo tonyredondo commented Jun 29, 2023

Summary of changes

This PR removes all arrays allocations for parameter types in NativeCallTargetDefinition structs, and also removes the multiple Marshall.Alloc* calls replacing it for a single allocation of a big segment of unmanaged memory that is freed at shutdown. For netcoreapp we don't process the string at all, instead we use the ReadOnlySpan trick with the string already marshalled as UTF16 with no allocations. (Reverted because it was taking more time than a normal unmanaged allocation + string marshalling, from 20ms to 1ms)

Reason for change

Currently we have 368 integrations being registered at startup, each integrations allocates an array object for the parameters types. Each parameter in this array calls allocates unmanaged memory to store the parameter type name. This creates overhead in the startup process that we are trying to reduce.

Test coverage

Tests has been updated with the new .ctor and source generator output.

@tonyredondo tonyredondo self-assigned this Jun 29, 2023
@DataDog DataDog deleted a comment from datadog-ddstaging bot Jun 29, 2023
@DataDog DataDog deleted a comment from andrewlock Jun 29, 2023
@DataDog DataDog deleted a comment from andrewlock Jun 29, 2023
@DataDog DataDog deleted a comment from datadog-ddstaging bot Jun 30, 2023
@DataDog DataDog deleted a comment from andrewlock Jun 30, 2023
@DataDog DataDog deleted a comment from andrewlock Jun 30, 2023
@DataDog DataDog deleted a comment from andrewlock Jun 30, 2023
@DataDog DataDog deleted a comment from andrewlock Jun 30, 2023
@DataDog DataDog deleted a comment from andrewlock Jun 30, 2023
@DataDog DataDog deleted a comment from andrewlock Jun 30, 2023
@DataDog DataDog deleted a comment from datadog-ddstaging bot Jun 30, 2023
@DataDog DataDog deleted a comment from andrewlock Jun 30, 2023
@DataDog DataDog deleted a comment from andrewlock Jun 30, 2023
@tonyredondo tonyredondo changed the title Tony/improve nativecalltargetdefinition marshalling Improve NativeCallTargetDefinition marshalling Jun 30, 2023
@DataDog DataDog deleted a comment from andrewlock Jul 3, 2023
@DataDog DataDog deleted a comment from andrewlock Jul 3, 2023
@DataDog DataDog deleted a comment from andrewlock Jul 3, 2023
@DataDog DataDog deleted a comment from andrewlock Jul 3, 2023
@DataDog DataDog deleted a comment from andrewlock Jul 3, 2023
@DataDog DataDog deleted a comment from andrewlock Jul 3, 2023
@DataDog DataDog deleted a comment from datadog-ddstaging bot Jul 3, 2023
@DataDog DataDog deleted a comment from andrewlock Jul 3, 2023
@DataDog DataDog deleted a comment from andrewlock Jul 3, 2023
@DataDog DataDog deleted a comment from andrewlock Jul 3, 2023
{
def.Dispose();
}
Instrumentations = Array.Empty<NativeCallTargetDefinition2>();
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't really mind, but note that using Array.Empty here is not beneficial. Because there will only ever be one of those empty arrays created, we still have the same number of allocations in total but we add one more generic type.

@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Jul 3, 2023

Datadog Report

Branch report: tony/improve-nativecalltargetdefinition-marshalling
Commit report: dc639a2

dd-trace-dotnet: 0 Failed, 0 New Flaky, 369791 Passed, 1466 Skipped, 31m 38.4s Wall Time

@andrewlock

This comment has been minimized.

@andrewlock

This comment has been minimized.

@andrewlock

This comment has been minimized.

@andrewlock

This comment has been minimized.

@andrewlock
Copy link
Member

Throughput/Crank Report:zap:

Throughput results for AspNetCoreSimpleController comparing the following branches/commits:

Cases where throughput results for the PR are worse than latest master (5% drop or greater), results are shown in red.

Note that these results are based on a single point-in-time result for each branch. For full results, see one of the many, many dashboards!

gantt
    title Throughput Linux x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (4326) (11.112M)   : 0, 11112274
    master (11.090M)   : 0, 11090030
    benchmarks/2.32.0 (11.375M)   : 0, 11374525
    benchmarks/2.9.0 (10.962M)   : 0, 10962162

    section Automatic
    This PR (4326) (7.734M)   : 0, 7734183
    master (7.769M)   : 0, 7769343
    benchmarks/2.32.0 (8.070M)   : 0, 8070318
    benchmarks/2.9.0 (7.961M)   : 0, 7961307

    section Trace stats
    master (7.770M)   : 0, 7769944
    benchmarks/2.32.0 (8.090M)   : 0, 8090308

    section Manual
    This PR (4326) (9.807M)   : 0, 9806681
    master (10.029M)   : 0, 10028784
    benchmarks/2.32.0 (10.358M)   : 0, 10357559

    section Manual + Automatic
    This PR (4326) (7.430M)   : 0, 7430236
    master (7.362M)   : 0, 7362416
    benchmarks/2.32.0 (7.698M)   : 0, 7697947

    section Version Conflict
    master (6.692M)   : 0, 6691750
    benchmarks/2.32.0 (6.996M)   : 0, 6995640

Loading
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (4326) (9.768M)   : 0, 9767885
    master (9.720M)   : 0, 9720071
    benchmarks/2.32.0 (9.619M)   : 0, 9619353
    benchmarks/2.9.0 (9.727M)   : 0, 9726575

    section Automatic
    This PR (4326) (6.649M)   : 0, 6648941
    master (6.740M)   : 0, 6740171
    benchmarks/2.32.0 (6.682M)   : 0, 6681889

    section Trace stats
    master (6.648M)   : 0, 6647613
    benchmarks/2.32.0 (6.899M)   : 0, 6899182

    section Manual
    This PR (4326) (8.433M)   : 0, 8432810
    master (8.566M)   : 0, 8565697
    benchmarks/2.32.0 (8.545M)   : 0, 8545110

    section Manual + Automatic
    This PR (4326) (6.484M)   : 0, 6484162
    master (6.424M)   : 0, 6424293
    benchmarks/2.32.0 (6.707M)   : 0, 6707147

    section Version Conflict
    master (5.900M)   : 0, 5899730
    benchmarks/2.32.0 (6.004M)   : 0, 6004290

Loading
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (4326) (10.217M)   : 0, 10216532
    master (10.384M)   : 0, 10384309
    benchmarks/2.32.0 (10.272M)   : 0, 10272136
    benchmarks/2.9.0 (10.841M)   : 0, 10841230

    section Automatic
    This PR (4326) (7.879M)   : 0, 7878966
    master (7.421M)   : 0, 7421270
    benchmarks/2.32.0 (7.559M)   : 0, 7559361
    benchmarks/2.9.0 (7.862M)   : 0, 7862268

    section Trace stats
    master (7.549M)   : 0, 7548894
    benchmarks/2.32.0 (7.562M)   : 0, 7562409

    section Manual
    This PR (4326) (9.497M)   : 0, 9496554
    master (9.511M)   : 0, 9510968
    benchmarks/2.32.0 (9.530M)   : 0, 9530406

    section Manual + Automatic
    This PR (4326) (7.330M)   : 0, 7329708
    master (7.324M)   : 0, 7324257
    benchmarks/2.32.0 (7.279M)   : 0, 7279188

    section Version Conflict
    master (6.695M)   : 0, 6694521
    benchmarks/2.32.0 (6.827M)   : 0, 6827118

Loading
gantt
    title Throughput Linux x64 (ASM) (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (4326) (7.689M)   : 0, 7688887
    master (7.539M)   : 0, 7538814
    benchmarks/2.32.0 (7.327M)   : 0, 7327005
    benchmarks/2.9.0 (7.934M)   : 0, 7933677

    section No attack
    This PR (4326) (2.186M)   : 0, 2186449
    master (2.195M)   : 0, 2195229
    benchmarks/2.32.0 (2.076M)   : 0, 2076414
    benchmarks/2.9.0 (3.287M)   : 0, 3286770

    section Attack
    This PR (4326) (1.885M)   : 0, 1884721
    master (1.882M)   : 0, 1882207
    benchmarks/2.32.0 (1.786M)   : 0, 1786036
    benchmarks/2.9.0 (2.600M)   : 0, 2600407

    section Blocking
    This PR (4326) (3.787M)   : 0, 3786962
    master (3.814M)   : 0, 3813723
    benchmarks/2.32.0 (3.490M)   : 0, 3490178

Loading

@andrewlock
Copy link
Member

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing the following branches/commits:

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

gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4326) - mean (3,023ms)  : 2966, 3080
     .   : milestone, 3023,
    master - mean (3,020ms)  : 2943, 3097
     .   : milestone, 3020,

    section CallTarget+Inlining+NGEN
    This PR (4326) - mean (3,842ms)  : 3752, 3933
     .   : milestone, 3842,
    master - mean (3,809ms)  : 3754, 3864
     .   : milestone, 3809,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4326) - mean (3,138ms)  : 3041, 3236
     .   : milestone, 3138,
    master - mean (3,143ms)  : 3061, 3226
     .   : milestone, 3143,

    section CallTarget+Inlining+NGEN
    This PR (4326) - mean (3,630ms)  : 3551, 3709
     .   : milestone, 3630,
    master - mean (3,647ms)  : 3575, 3719
     .   : milestone, 3647,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4326) - mean (3,111ms)  : 2997, 3224
     .   : milestone, 3111,
    master - mean (3,121ms)  : 3006, 3236
     .   : milestone, 3121,

    section CallTarget+Inlining+NGEN
    This PR (4326) - mean (3,606ms)  : 3521, 3691
     .   : milestone, 3606,
    master - mean (3,610ms)  : 3533, 3687
     .   : milestone, 3610,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4326) - mean (190ms)  : 188, 193
     .   : milestone, 190,
    master - mean (190ms)  : 186, 193
     .   : milestone, 190,

    section CallTarget+Inlining+NGEN
    This PR (4326) - mean (1,116ms)  : 1023, 1208
     .   : milestone, 1116,
    master - mean (1,092ms)  : 1070, 1114
     .   : milestone, 1092,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4326) - mean (372ms)  : 368, 377
     .   : milestone, 372,
    master - mean (370ms)  : 365, 375
     .   : milestone, 370,

    section CallTarget+Inlining+NGEN
    This PR (4326) - mean (1,171ms)  : 1136, 1205
     .   : milestone, 1171,
    master - mean (1,163ms)  : 1112, 1213
     .   : milestone, 1163,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4326) - mean (360ms)  : 354, 366
     .   : milestone, 360,
    master - mean (360ms)  : 354, 365
     .   : milestone, 360,

    section CallTarget+Inlining+NGEN
    This PR (4326) - mean (1,126ms)  : 1099, 1152
     .   : milestone, 1126,
    master - mean (1,122ms)  : 1086, 1159
     .   : milestone, 1122,

Loading

@andrewlock
Copy link
Member

Benchmarks Report 🐌

Benchmarks for #4326 compared to master:

  • 2 benchmarks are faster, with geometric mean 1.121
  • All benchmarks have the same allocations

The following thresholds were used for comparing the benchmark speeds:

  • Mann–Whitney U test with statistical test for significance of 5%
  • Only results indicating a difference greater than 10% and 0.3 ns are considered.

Allocation changes below 0.5% are ignored.

Benchmark details

Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 469μs 297ns 1.15μs 0 0 0 2.62 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 646μs 285ns 1.1μs 0 0 0 2.62 KB
master WriteAndFlushEnrichedTraces net472 792μs 363ns 1.36μs 0.396 0 0 3.22 KB
#4326 WriteAndFlushEnrichedTraces net6.0 481μs 144ns 558ns 0 0 0 2.62 KB
#4326 WriteAndFlushEnrichedTraces netcoreapp3.1 650μs 181ns 653ns 0 0 0 2.63 KB
#4326 WriteAndFlushEnrichedTraces net472 804μs 368ns 1.38μs 0.401 0 0 3.22 KB
Benchmarks.Trace.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 39.1μs 34.9ns 135ns 0.0196 0 0 1.65 KB
master AllCycleSimpleBody netcoreapp3.1 41.5μs 55.1ns 199ns 0.0205 0 0 1.63 KB
master AllCycleSimpleBody net472 41μs 8.68ns 33.6ns 0.266 0 0 1.69 KB
master AllCycleMoreComplexBody net6.0 220μs 122ns 471ns 0.109 0 0 9.22 KB
master AllCycleMoreComplexBody netcoreapp3.1 228μs 453ns 1.63μs 0.115 0 0 9.12 KB
master AllCycleMoreComplexBody net472 238μs 53.6ns 208ns 1.42 0 0 9.28 KB
master ObjectExtractorSimpleBody net6.0 126ns 0.0824ns 0.308ns 0.00397 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 174ns 0.227ns 0.878ns 0.00375 0 0 272 B
master ObjectExtractorSimpleBody net472 145ns 0.116ns 0.435ns 0.0446 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 2.98μs 0.964ns 3.73ns 0.0537 0 0 3.88 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 4.35μs 2.28ns 8.82ns 0.0521 0 0 3.78 KB
master ObjectExtractorMoreComplexBody net472 4.17μs 2.05ns 7.95ns 0.618 0.00624 0 3.89 KB
#4326 AllCycleSimpleBody net6.0 39.3μs 33.6ns 130ns 0.0192 0 0 1.65 KB
#4326 AllCycleSimpleBody netcoreapp3.1 41.9μs 208ns 858ns 0.0199 0 0 1.63 KB
#4326 AllCycleSimpleBody net472 41.1μs 51.9ns 180ns 0.266 0 0 1.69 KB
#4326 AllCycleMoreComplexBody net6.0 221μs 64.6ns 242ns 0.11 0 0 9.22 KB
#4326 AllCycleMoreComplexBody netcoreapp3.1 229μs 241ns 903ns 0.113 0 0 9.12 KB
#4326 AllCycleMoreComplexBody net472 238μs 64.1ns 248ns 1.43 0 0 9.28 KB
#4326 ObjectExtractorSimpleBody net6.0 122ns 0.0392ns 0.136ns 0.00395 0 0 280 B
#4326 ObjectExtractorSimpleBody netcoreapp3.1 170ns 0.318ns 1.23ns 0.0037 0 0 272 B
#4326 ObjectExtractorSimpleBody net472 149ns 0.176ns 0.68ns 0.0446 0 0 281 B
#4326 ObjectExtractorMoreComplexBody net6.0 2.97μs 1.15ns 4.45ns 0.055 0 0 3.88 KB
#4326 ObjectExtractorMoreComplexBody netcoreapp3.1 4.14μs 3.05ns 11ns 0.0518 0 0 3.78 KB
#4326 ObjectExtractorMoreComplexBody net472 4.24μs 2.29ns 8.89ns 0.617 0.00636 0 3.89 KB
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net6.0 167μs 102ns 380ns 0.167 0 0 18.03 KB
master SendRequest netcoreapp3.1 185μs 299ns 1.16μs 0.185 0 0 20.09 KB
master SendRequest net472 0ns 0ns 0ns 0 0 0 0 b
#4326 SendRequest net6.0 166μs 300ns 1.16μs 0.248 0 0 18.03 KB
#4326 SendRequest netcoreapp3.1 190μs 226ns 846ns 0.187 0 0 20.09 KB
#4326 SendRequest net472 0.00115ns 0.000376ns 0.00146ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 514μs 410ns 1.59μs 0.5 0 0 41.49 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 631μs 1.18μs 4.27μs 0.312 0 0 41.65 KB
master WriteAndFlushEnrichedTraces net472 796μs 3.9μs 16.1μs 8.25 2.36 0.393 53.25 KB
#4326 WriteAndFlushEnrichedTraces net6.0 528μs 454ns 1.76μs 0.765 0 0 41.67 KB
#4326 WriteAndFlushEnrichedTraces netcoreapp3.1 623μs 1.58μs 6.13μs 0.319 0 0 41.54 KB
#4326 WriteAndFlushEnrichedTraces net472 778μs 2.47μs 9.55μs 8.1 2.31 0.386 53.25 KB
Benchmarks.Trace.DbCommandBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #4326

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑netcoreapp3.1 1.128 1,260.16 1,116.71

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 891ns 0.473ns 1.64ns 0.00988 0 0 720 B
master ExecuteNonQuery netcoreapp3.1 1.26μs 0.355ns 1.37ns 0.00942 0 0 720 B
master ExecuteNonQuery net472 1.34μs 0.625ns 2.42ns 0.108 0 0 682 B
#4326 ExecuteNonQuery net6.0 912ns 0.324ns 1.25ns 0.0101 0 0 720 B
#4326 ExecuteNonQuery netcoreapp3.1 1.12μs 0.907ns 3.51ns 0.0098 0 0 720 B
#4326 ExecuteNonQuery net472 1.41μs 0.684ns 2.65ns 0.108 0.000706 0 682 B
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.06μs 0.788ns 2.84ns 0.0132 0 0 944 B
master CallElasticsearch netcoreapp3.1 1.35μs 0.444ns 1.72ns 0.0128 0 0 944 B
master CallElasticsearch net472 1.96μs 0.441ns 1.65ns 0.151 0.000982 0 955 B
master CallElasticsearchAsync net6.0 998ns 0.374ns 1.4ns 0.013 0 0 920 B
master CallElasticsearchAsync netcoreapp3.1 1.31μs 0.471ns 1.7ns 0.0132 0 0 992 B
master CallElasticsearchAsync net472 2.16μs 0.679ns 2.45ns 0.16 0.00108 0 1.01 KB
#4326 CallElasticsearch net6.0 973ns 0.2ns 0.749ns 0.0133 0 0 944 B
#4326 CallElasticsearch netcoreapp3.1 1.32μs 0.599ns 2.32ns 0.0125 0 0 944 B
#4326 CallElasticsearch net472 1.96μs 0.327ns 1.18ns 0.152 0.000979 0 955 B
#4326 CallElasticsearchAsync net6.0 1.02μs 0.421ns 1.63ns 0.0129 0 0 920 B
#4326 CallElasticsearchAsync netcoreapp3.1 1.34μs 0.915ns 3.42ns 0.0134 0 0 992 B
#4326 CallElasticsearchAsync net472 2.16μs 0.299ns 1.16ns 0.16 0 0 1.01 KB
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net6.0 1.04μs 0.4ns 1.5ns 0.0128 0 0 912 B
master ExecuteAsync netcoreapp3.1 1.33μs 0.338ns 1.26ns 0.0122 0 0 912 B
master ExecuteAsync net472 1.51μs 0.612ns 2.29ns 0.138 0.000756 0 875 B
#4326 ExecuteAsync net6.0 1.06μs 4.52ns 20.2ns 0.0127 0 0 912 B
#4326 ExecuteAsync netcoreapp3.1 1.36μs 0.723ns 2.8ns 0.0123 0 0 912 B
#4326 ExecuteAsync net472 1.52μs 0.552ns 2.14ns 0.139 0 0 875 B
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendAsync net6.0 3.73μs 1.68ns 6.51ns 0.026 0 0 1.9 KB
master SendAsync netcoreapp3.1 4.39μs 1.67ns 6.46ns 0.0329 0 0 2.43 KB
master SendAsync net472 6.86μs 12.5ns 46.8ns 0.476 0 0 3 KB
#4326 SendAsync net6.0 3.47μs 1.35ns 5.21ns 0.0259 0 0 1.9 KB
#4326 SendAsync netcoreapp3.1 4.17μs 1.77ns 6.63ns 0.0333 0 0 2.43 KB
#4326 SendAsync net472 6.84μs 2.36ns 8.83ns 0.476 0 0 3 KB
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 1.29μs 0.651ns 2.52ns 0.0226 0 0 1.62 KB
master EnrichedLog netcoreapp3.1 2.06μs 0.808ns 3.13ns 0.0219 0 0 1.62 KB
master EnrichedLog net472 2.23μs 1.09ns 4.09ns 0.244 0 0 1.54 KB
#4326 EnrichedLog net6.0 1.4μs 0.805ns 3.01ns 0.0224 0 0 1.62 KB
#4326 EnrichedLog netcoreapp3.1 1.92μs 0.644ns 2.41ns 0.0221 0 0 1.62 KB
#4326 EnrichedLog net472 2.4μs 2.79ns 10.8ns 0.245 0 0 1.54 KB
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 111μs 138ns 515ns 0.0551 0 0 4.21 KB
master EnrichedLog netcoreapp3.1 117μs 275ns 1.06μs 0.0582 0 0 4.21 KB
master EnrichedLog net472 148μs 235ns 911ns 0.657 0.219 0 4.38 KB
#4326 EnrichedLog net6.0 112μs 183ns 711ns 0.0564 0 0 4.21 KB
#4326 EnrichedLog netcoreapp3.1 119μs 142ns 550ns 0 0 0 4.21 KB
#4326 EnrichedLog net472 149μs 104ns 404ns 0.668 0.223 0 4.38 KB
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 3.13μs 0.89ns 3.33ns 0.0516 0 0 3.71 KB
master EnrichedLog netcoreapp3.1 3.95μs 1.44ns 5.58ns 0.0506 0 0 3.69 KB
master EnrichedLog net472 4.75μs 2.2ns 7.93ns 0.526 0.00237 0 3.31 KB
#4326 EnrichedLog net6.0 3.16μs 0.839ns 3.14ns 0.052 0 0 3.71 KB
#4326 EnrichedLog netcoreapp3.1 3.87μs 1.08ns 4.04ns 0.0502 0 0 3.69 KB
#4326 EnrichedLog net472 4.76μs 1.45ns 5.63ns 0.525 0.0024 0 3.31 KB
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendReceive net6.0 1.11μs 0.883ns 3.3ns 0.0155 0 0 1.11 KB
master SendReceive netcoreapp3.1 1.38μs 1.08ns 4.02ns 0.0152 0 0 1.11 KB
master SendReceive net472 1.72μs 1.3ns 4.88ns 0.177 0.000855 0 1.12 KB
#4326 SendReceive net6.0 1.15μs 0.482ns 1.8ns 0.0156 0 0 1.11 KB
#4326 SendReceive netcoreapp3.1 1.44μs 0.548ns 2.05ns 0.015 0 0 1.11 KB
#4326 SendReceive net472 1.84μs 2.19ns 8.49ns 0.177 0 0 1.12 KB
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 2.58μs 0.865ns 3.35ns 0.0211 0 0 1.53 KB
master EnrichedLog netcoreapp3.1 3.64μs 1.14ns 4.1ns 0.0199 0 0 1.58 KB
master EnrichedLog net472 4.18μs 1.51ns 5.65ns 0.309 0 0 1.96 KB
#4326 EnrichedLog net6.0 2.6μs 0.524ns 1.96ns 0.0207 0 0 1.53 KB
#4326 EnrichedLog netcoreapp3.1 3.63μs 1.55ns 5.59ns 0.02 0 0 1.58 KB
#4326 EnrichedLog net472 4.09μs 1.5ns 5.82ns 0.311 0 0 1.96 KB
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 396ns 0.15ns 0.56ns 0.00748 0 0 536 B
master StartFinishSpan netcoreapp3.1 478ns 0.19ns 0.685ns 0.00724 0 0 536 B
master StartFinishSpan net472 643ns 0.205ns 0.794ns 0.0852 0 0 538 B
master StartFinishScope net6.0 538ns 0.127ns 0.456ns 0.0093 0 0 656 B
master StartFinishScope netcoreapp3.1 630ns 0.214ns 0.828ns 0.00907 0 0 656 B
master StartFinishScope net472 898ns 0.554ns 2.14ns 0.0981 0 0 618 B
#4326 StartFinishSpan net6.0 377ns 0.135ns 0.486ns 0.00753 0 0 536 B
#4326 StartFinishSpan netcoreapp3.1 484ns 0.206ns 0.798ns 0.00724 0 0 536 B
#4326 StartFinishSpan net472 612ns 0.232ns 0.898ns 0.0853 0 0 538 B
#4326 StartFinishScope net6.0 536ns 0.131ns 0.491ns 0.00922 0 0 656 B
#4326 StartFinishScope netcoreapp3.1 673ns 0.388ns 1.5ns 0.00911 0 0 656 B
#4326 StartFinishScope net472 831ns 0.371ns 1.44ns 0.0978 0 0 618 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #4326

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 1.114 608.85 546.74

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 609ns 0.263ns 0.986ns 0.00915 0 0 656 B
master RunOnMethodBegin netcoreapp3.1 858ns 0.349ns 1.21ns 0.00905 0 0 656 B
master RunOnMethodBegin net472 911ns 0.232ns 0.868ns 0.0982 0 0 618 B
#4326 RunOnMethodBegin net6.0 547ns 0.174ns 0.651ns 0.00911 0 0 656 B
#4326 RunOnMethodBegin netcoreapp3.1 803ns 0.625ns 2.34ns 0.0088 0 0 656 B
#4326 RunOnMethodBegin net472 993ns 0.301ns 1.13ns 0.0979 0 0 618 B

@tonyredondo tonyredondo merged commit 28352a5 into master Jul 4, 2023
@tonyredondo tonyredondo deleted the tony/improve-nativecalltargetdefinition-marshalling branch July 4, 2023 17:40
@github-actions github-actions bot added this to the vNext milestone Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants