-
Notifications
You must be signed in to change notification settings - Fork 145
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
Improve NativeCallTargetDefinition marshalling #4326
Conversation
…llTargetDefinition strings.
{ | ||
def.Dispose(); | ||
} | ||
Instrumentations = Array.Empty<NativeCallTargetDefinition2>(); |
There was a problem hiding this comment.
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.
tracer/src/Datadog.Trace/ClrProfiler/NativeCallTargetUnmanagedMemoryHelper.cs
Show resolved
Hide resolved
tracer/src/Datadog.Trace/ClrProfiler/NativeCallTargetUnmanagedMemoryHelper.cs
Show resolved
Hide resolved
tracer/src/Datadog.Trace/ClrProfiler/NativeCallTargetUnmanagedMemoryHelper.cs
Show resolved
Hide resolved
tracer/src/Datadog.Trace/ClrProfiler/NativeCallTargetUnmanagedMemoryHelper.cs
Show resolved
Hide resolved
Datadog ReportBranch report: ✅ |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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
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
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
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
|
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:
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,
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,
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,
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,
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,
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,
|
Benchmarks Report 🐌Benchmarks for #4326 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.DbCommandBenchmark - Faster 🎉 Same allocations ✔️
|
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
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 |
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.