-
Notifications
You must be signed in to change notification settings - Fork 150
Mark all classes as sealed or static
#7879
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
Conversation
1c2cde7 to
ec3b535
Compare
|
| public static readonly IFormatterResolver Instance = new SpanFormatterResolver(); | ||
|
|
||
| private readonly SpanMessagePackFormatter _formatter; | ||
| private readonly object _formatter; |
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.
This was necessary because line 28 no longer compiles otherwise:
return (IMessagePackFormatter<T>)_formatter;|
|
||
| namespace Datadog.Trace.Agent.Transports | ||
| { | ||
| #if NET5_0_OR_GREATER // in .NET 6 we derive a SocketHandlerRequestFactory |
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.
In .NET 6 we derive from this to create SocketHandlerRequestFactory so we can't be sealed
| @@ -8,7 +8,9 @@ namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.Logging.NLog.LogsInjecti | |||
| /// <summary> | |||
| /// Duck type for MappedDiagnosticsContext in NLog 1.0+ | |||
| /// </summary> | |||
| #pragma warning disable DDSEAL001 // Types should be sealed where possible. Types used for duck-typing cannot be sealed. | |||
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.
This is actually a (rare) class based duck type. We don't recommend these now (and can probably update to use interface instead, so just ignoring it for now
| #pragma warning disable DDSEAL001 // Types should be sealed where possible. Types used for duck-typing cannot be sealed. | ||
| internal class MappedDiagnosticsLogicalContextSetterProxy | ||
| #pragma warning restore DDSEAL001 |
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.
This is actually a (rare) class based duck type. We don't recommend these now (and can probably update to use interface instead, so just ignoring it for now
| #pragma warning disable DDSEAL001 // Types should be sealed where possible. Types used for duck-typing cannot be sealed. | ||
| internal class EndpointFeatureProxy | ||
| #pragma warning restore DDSEAL001 |
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.
This is actually a (rare) class based duck type. We don't recommend these now (and can probably update to use interface instead, so just ignoring it for now
BenchmarksBenchmarks Report for benchmark platform 🐌Benchmarks for #7879 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.ActivityBenchmark - Same speed ✔️ Fewer allocations 🎉
|
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net472 | 6.01 KB | 5.94 KB | -68 B | -1.13% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StartStopWithChild |
net6.0 | 10.9μs | 58.1ns | 308ns | 0 | 0 | 0 | 5.5 KB |
| master | StartStopWithChild |
netcoreapp3.1 | 14μs | 73.8ns | 369ns | 0 | 0 | 0 | 5.71 KB |
| master | StartStopWithChild |
net472 | 22.6μs | 114ns | 534ns | 1.05 | 0.419 | 0.105 | 6.01 KB |
| #7879 | StartStopWithChild |
net6.0 | 10.6μs | 58.8ns | 367ns | 0 | 0 | 0 | 5.5 KB |
| #7879 | StartStopWithChild |
netcoreapp3.1 | 14μs | 68.7ns | 315ns | 0 | 0 | 0 | 5.71 KB |
| #7879 | StartStopWithChild |
net472 | 22.2μs | 102ns | 394ns | 0.99 | 0.44 | 0.11 | 5.94 KB |
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 | 1.27ms | 508ns | 1.97μs | 0 | 0 | 0 | 2.7 KB |
| master | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 1.37ms | 479ns | 1.79μs | 0 | 0 | 0 | 2.7 KB |
| master | WriteAndFlushEnrichedTraces |
net472 | 1.72ms | 792ns | 2.74μs | 0 | 0 | 0 | 3.26 KB |
| #7879 | WriteAndFlushEnrichedTraces |
net6.0 | 1.25ms | 49.4ns | 185ns | 0 | 0 | 0 | 2.7 KB |
| #7879 | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 1.39ms | 189ns | 680ns | 0 | 0 | 0 | 2.7 KB |
| #7879 | WriteAndFlushEnrichedTraces |
net472 | 1.73ms | 1.83μs | 6.87μs | 0 | 0 | 0 | 3.26 KB |
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | AllCycleSimpleBody |
net6.0 | 1.11μs | 4.88ns | 18.2ns | 0 | 0 | 0 | 1.22 KB |
| master | AllCycleSimpleBody |
netcoreapp3.1 | 1.4μs | 7.96ns | 55.1ns | 0 | 0 | 0 | 1.2 KB |
| master | AllCycleSimpleBody |
net472 | 1.02μs | 0.618ns | 2.39ns | 0.193 | 0 | 0 | 1.23 KB |
| master | AllCycleMoreComplexBody |
net6.0 | 7.23μs | 37ns | 181ns | 0 | 0 | 0 | 4.72 KB |
| master | AllCycleMoreComplexBody |
netcoreapp3.1 | 8.85μs | 45.5ns | 208ns | 0 | 0 | 0 | 4.62 KB |
| master | AllCycleMoreComplexBody |
net472 | 7.73μs | 4.7ns | 18.2ns | 0.734 | 0 | 0 | 4.74 KB |
| master | ObjectExtractorSimpleBody |
net6.0 | 321ns | 0.214ns | 0.828ns | 0 | 0 | 0 | 280 B |
| master | ObjectExtractorSimpleBody |
netcoreapp3.1 | 406ns | 2.14ns | 10.5ns | 0 | 0 | 0 | 272 B |
| master | ObjectExtractorSimpleBody |
net472 | 295ns | 0.0247ns | 0.0925ns | 0.0445 | 0 | 0 | 281 B |
| master | ObjectExtractorMoreComplexBody |
net6.0 | 6.31μs | 30.5ns | 122ns | 0 | 0 | 0 | 3.78 KB |
| master | ObjectExtractorMoreComplexBody |
netcoreapp3.1 | 7.94μs | 38ns | 152ns | 0 | 0 | 0 | 3.69 KB |
| master | ObjectExtractorMoreComplexBody |
net472 | 6.7μs | 1.87ns | 7.22ns | 0.572 | 0 | 0 | 3.8 KB |
| #7879 | AllCycleSimpleBody |
net6.0 | 1.07μs | 6.16ns | 47.7ns | 0 | 0 | 0 | 1.22 KB |
| #7879 | AllCycleSimpleBody |
netcoreapp3.1 | 1.34μs | 7.71ns | 59.7ns | 0 | 0 | 0 | 1.2 KB |
| #7879 | AllCycleSimpleBody |
net472 | 1.03μs | 4.78ns | 18.5ns | 0.19 | 0 | 0 | 1.23 KB |
| #7879 | AllCycleMoreComplexBody |
net6.0 | 7.16μs | 37.2ns | 182ns | 0 | 0 | 0 | 4.72 KB |
| #7879 | AllCycleMoreComplexBody |
netcoreapp3.1 | 8.95μs | 47ns | 226ns | 0 | 0 | 0 | 4.62 KB |
| #7879 | AllCycleMoreComplexBody |
net472 | 7.68μs | 9.17ns | 35.5ns | 0.723 | 0 | 0 | 4.74 KB |
| #7879 | ObjectExtractorSimpleBody |
net6.0 | 323ns | 0.205ns | 0.795ns | 0 | 0 | 0 | 280 B |
| #7879 | ObjectExtractorSimpleBody |
netcoreapp3.1 | 399ns | 2.2ns | 13.4ns | 0 | 0 | 0 | 272 B |
| #7879 | ObjectExtractorSimpleBody |
net472 | 302ns | 0.058ns | 0.225ns | 0.044 | 0 | 0 | 281 B |
| #7879 | ObjectExtractorMoreComplexBody |
net6.0 | 6.39μs | 1.62ns | 5.83ns | 0 | 0 | 0 | 3.78 KB |
| #7879 | ObjectExtractorMoreComplexBody |
netcoreapp3.1 | 7.88μs | 40ns | 174ns | 0 | 0 | 0 | 3.69 KB |
| #7879 | ObjectExtractorMoreComplexBody |
net472 | 6.69μs | 1.29ns | 4.82ns | 0.572 | 0 | 0 | 3.8 KB |
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EncodeArgs |
net6.0 | 76.5μs | 50.7ns | 190ns | 0 | 0 | 0 | 32.4 KB |
| master | EncodeArgs |
netcoreapp3.1 | 98.6μs | 139ns | 539ns | 0 | 0 | 0 | 32.4 KB |
| master | EncodeArgs |
net472 | 110μs | 20.2ns | 78.4ns | 4.94 | 0 | 0 | 32.5 KB |
| master | EncodeLegacyArgs |
net6.0 | 145μs | 26.7ns | 103ns | 0 | 0 | 0 | 2.14 KB |
| master | EncodeLegacyArgs |
netcoreapp3.1 | 195μs | 14ns | 52.4ns | 0 | 0 | 0 | 2.14 KB |
| master | EncodeLegacyArgs |
net472 | 264μs | 21.9ns | 84.7ns | 0 | 0 | 0 | 2.14 KB |
| #7879 | EncodeArgs |
net6.0 | 77.2μs | 45.8ns | 178ns | 0 | 0 | 0 | 32.4 KB |
| #7879 | EncodeArgs |
netcoreapp3.1 | 97.6μs | 200ns | 774ns | 0 | 0 | 0 | 32.4 KB |
| #7879 | EncodeArgs |
net472 | 109μs | 11.3ns | 42.2ns | 4.91 | 0 | 0 | 32.5 KB |
| #7879 | EncodeLegacyArgs |
net6.0 | 147μs | 16.7ns | 64.7ns | 0 | 0 | 0 | 2.14 KB |
| #7879 | EncodeLegacyArgs |
netcoreapp3.1 | 199μs | 91.4ns | 342ns | 0 | 0 | 0 | 2.14 KB |
| #7879 | EncodeLegacyArgs |
net472 | 266μs | 17.3ns | 64.9ns | 0 | 0 | 0 | 2.15 KB |
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | RunWafRealisticBenchmark |
net6.0 | 426μs | 1.66μs | 6.22μs | 0 | 0 | 0 | 4.55 KB |
| master | RunWafRealisticBenchmark |
netcoreapp3.1 | 628μs | 20.9μs | 209μs | 0 | 0 | 0 | 4.48 KB |
| master | RunWafRealisticBenchmark |
net472 | 501μs | 608ns | 2.35μs | 0 | 0 | 0 | 0 b |
| master | RunWafRealisticBenchmarkWithAttack |
net6.0 | 310μs | 1.49μs | 5.77μs | 0 | 0 | 0 | 2.24 KB |
| master | RunWafRealisticBenchmarkWithAttack |
netcoreapp3.1 | 360μs | 3.71μs | 36.2μs | 0 | 0 | 0 | 2.22 KB |
| master | RunWafRealisticBenchmarkWithAttack |
net472 | 369μs | 413ns | 1.55μs | 0 | 0 | 0 | 0 b |
| #7879 | RunWafRealisticBenchmark |
net6.0 | 434μs | 1.12μs | 4.04μs | 0 | 0 | 0 | 4.55 KB |
| #7879 | RunWafRealisticBenchmark |
netcoreapp3.1 | 464μs | 2.48μs | 21.2μs | 0 | 0 | 0 | 4.48 KB |
| #7879 | RunWafRealisticBenchmark |
net472 | 495μs | 450ns | 1.68μs | 0 | 0 | 0 | 0 b |
| #7879 | RunWafRealisticBenchmarkWithAttack |
net6.0 | 312μs | 1.07μs | 3.7μs | 0 | 0 | 0 | 2.24 KB |
| #7879 | RunWafRealisticBenchmarkWithAttack |
netcoreapp3.1 | 335μs | 1.61μs | 7.57μs | 0 | 0 | 0 | 2.22 KB |
| #7879 | RunWafRealisticBenchmarkWithAttack |
net472 | 367μs | 237ns | 856ns | 0 | 0 | 0 | 0 b |
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 | 83.4μs | 95.6ns | 331ns | 0 | 0 | 0 | 18.97 KB |
| master | SendRequest |
netcoreapp3.1 | 98.1μs | 430ns | 2.91μs | 0 | 0 | 0 | 21.18 KB |
| master | SendRequest |
net472 | 0ns | 0ns | 0ns | 0 | 0 | 0 | 0 b |
| #7879 | SendRequest |
net6.0 | 84.7μs | 82.2ns | 308ns | 0 | 0 | 0 | 18.97 KB |
| #7879 | SendRequest |
netcoreapp3.1 | 97.1μs | 475ns | 2.38μs | 0 | 0 | 0 | 21.25 KB |
| #7879 | SendRequest |
net472 | 0ns | 0ns | 0ns | 0 | 0 | 0 | 0 b |
Benchmarks.Trace.CharSliceBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | OriginalCharSlice |
net6.0 | 2.03ms | 1.16μs | 4.18μs | 0 | 0 | 0 | 640 KB |
| master | OriginalCharSlice |
netcoreapp3.1 | 3.89ms | 1.77μs | 6.63μs | 0 | 0 | 0 | 640.05 KB |
| master | OriginalCharSlice |
net472 | 2.62ms | 603ns | 2.26μs | 0 | 0 | 0 | 638.98 KB |
| master | OptimizedCharSlice |
net6.0 | 1.36ms | 633ns | 2.37μs | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSlice |
netcoreapp3.1 | 1.66ms | 5.17μs | 33.9μs | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSlice |
net472 | 1.89ms | 759ns | 2.94μs | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSliceWithPool |
net6.0 | 1.06ms | 979ns | 3.79μs | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSliceWithPool |
netcoreapp3.1 | 1.86ms | 1.67μs | 6.46μs | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSliceWithPool |
net472 | 1.14ms | 977ns | 3.78μs | 0 | 0 | 0 | 0 b |
| #7879 | OriginalCharSlice |
net6.0 | 1.95ms | 672ns | 2.6μs | 0 | 0 | 0 | 640 KB |
| #7879 | OriginalCharSlice |
netcoreapp3.1 | 3.93ms | 13.2μs | 51.1μs | 0 | 0 | 0 | 640.05 KB |
| #7879 | OriginalCharSlice |
net472 | 2.6ms | 668ns | 2.41μs | 0 | 0 | 0 | 638.98 KB |
| #7879 | OptimizedCharSlice |
net6.0 | 1.46ms | 474ns | 1.84μs | 0 | 0 | 0 | 0 b |
| #7879 | OptimizedCharSlice |
netcoreapp3.1 | 1.68ms | 8.82μs | 57.8μs | 0 | 0 | 0 | 0 b |
| #7879 | OptimizedCharSlice |
net472 | 1.91ms | 828ns | 2.98μs | 0 | 0 | 0 | 0 b |
| #7879 | OptimizedCharSliceWithPool |
net6.0 | 1.06ms | 1.14μs | 4.4μs | 0 | 0 | 0 | 0 b |
| #7879 | OptimizedCharSliceWithPool |
netcoreapp3.1 | 1.87ms | 2.05μs | 7.95μs | 0 | 0 | 0 | 0 b |
| #7879 | OptimizedCharSliceWithPool |
net472 | 1.13ms | 599ns | 2.32μs | 0 | 0 | 0 | 0 b |
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Fewer allocations 🎉
Fewer allocations 🎉 in #7879
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1
43.27 KB
42.75 KB
-526 B
-1.22%
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 | 43.27 KB | 42.75 KB | -526 B | -1.22% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | WriteAndFlushEnrichedTraces |
net6.0 | 727μs | 3.51μs | 14.5μs | 0 | 0 | 0 | 41.62 KB |
| master | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 801μs | 3.49μs | 12.6μs | 0 | 0 | 0 | 43.27 KB |
| master | WriteAndFlushEnrichedTraces |
net472 | 960μs | 4.53μs | 17.5μs | 5.21 | 0 | 0 | 55.55 KB |
| #7879 | WriteAndFlushEnrichedTraces |
net6.0 | 718μs | 3.7μs | 24μs | 0 | 0 | 0 | 41.68 KB |
| #7879 | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 717μs | 1.3μs | 4.85μs | 0 | 0 | 0 | 42.75 KB |
| #7879 | WriteAndFlushEnrichedTraces |
net472 | 948μs | 4.36μs | 16.9μs | 4.46 | 0 | 0 | 55.81 KB |
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | ExecuteNonQuery |
net6.0 | 1.93μs | 2.12ns | 7.92ns | 0 | 0 | 0 | 968 B |
| master | ExecuteNonQuery |
netcoreapp3.1 | 2.54μs | 7.12ns | 27.6ns | 0 | 0 | 0 | 960 B |
| master | ExecuteNonQuery |
net472 | 2.85μs | 1.57ns | 5.86ns | 0.143 | 0 | 0 | 931 B |
| #7879 | ExecuteNonQuery |
net6.0 | 1.98μs | 1.28ns | 4.79ns | 0 | 0 | 0 | 968 B |
| #7879 | ExecuteNonQuery |
netcoreapp3.1 | 2.5μs | 8.64ns | 32.3ns | 0 | 0 | 0 | 960 B |
| #7879 | ExecuteNonQuery |
net472 | 2.85μs | 2.51ns | 9.37ns | 0.142 | 0 | 0 | 931 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.71μs | 8.21ns | 32.8ns | 0 | 0 | 0 | 952 B |
| master | CallElasticsearch |
netcoreapp3.1 | 2.21μs | 9.66ns | 37.4ns | 0 | 0 | 0 | 968 B |
| master | CallElasticsearch |
net472 | 3.4μs | 3.84ns | 14.9ns | 0.136 | 0 | 0 | 955 B |
| master | CallElasticsearchAsync |
net6.0 | 1.69μs | 8.7ns | 38.9ns | 0 | 0 | 0 | 928 B |
| master | CallElasticsearchAsync |
netcoreapp3.1 | 2.49μs | 9.09ns | 32.8ns | 0 | 0 | 0 | 1.02 KB |
| master | CallElasticsearchAsync |
net472 | 3.54μs | 5.85ns | 22.7ns | 0.159 | 0 | 0 | 1.01 KB |
| #7879 | CallElasticsearch |
net6.0 | 1.71μs | 8.03ns | 31.1ns | 0 | 0 | 0 | 952 B |
| #7879 | CallElasticsearch |
netcoreapp3.1 | 2.18μs | 1.75ns | 6.76ns | 0 | 0 | 0 | 968 B |
| #7879 | CallElasticsearch |
net472 | 3.41μs | 5.39ns | 20.9ns | 0.136 | 0 | 0 | 955 B |
| #7879 | CallElasticsearchAsync |
net6.0 | 1.72μs | 3.79ns | 14.2ns | 0 | 0 | 0 | 928 B |
| #7879 | CallElasticsearchAsync |
netcoreapp3.1 | 2.34μs | 10.5ns | 40.5ns | 0 | 0 | 0 | 1.02 KB |
| #7879 | CallElasticsearchAsync |
net472 | 3.42μs | 3.09ns | 12ns | 0.153 | 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.85μs | 1ns | 3.61ns | 0 | 0 | 0 | 896 B |
| master | ExecuteAsync |
netcoreapp3.1 | 2.45μs | 4.56ns | 17.7ns | 0 | 0 | 0 | 896 B |
| master | ExecuteAsync |
net472 | 2.53μs | 2.68ns | 10.4ns | 0.127 | 0 | 0 | 859 B |
| #7879 | ExecuteAsync |
net6.0 | 1.96μs | 2.87ns | 11.1ns | 0 | 0 | 0 | 896 B |
| #7879 | ExecuteAsync |
netcoreapp3.1 | 2.28μs | 7.34ns | 28.4ns | 0 | 0 | 0 | 896 B |
| #7879 | ExecuteAsync |
net472 | 2.55μs | 5.3ns | 20.5ns | 0.128 | 0 | 0 | 858 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 | 7.05μs | 12.6ns | 48.7ns | 0 | 0 | 0 | 2.29 KB |
| master | SendAsync |
netcoreapp3.1 | 8.29μs | 15.1ns | 58.3ns | 0 | 0 | 0 | 2.83 KB |
| master | SendAsync |
net472 | 12.3μs | 6.37ns | 24.7ns | 0.431 | 0 | 0 | 3.08 KB |
| #7879 | SendAsync |
net6.0 | 7.19μs | 20.4ns | 76.4ns | 0 | 0 | 0 | 2.29 KB |
| #7879 | SendAsync |
netcoreapp3.1 | 8.4μs | 15.5ns | 57.8ns | 0 | 0 | 0 | 2.83 KB |
| #7879 | SendAsync |
net472 | 12.2μs | 13.1ns | 50.6ns | 0.487 | 0 | 0 | 3.08 KB |
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ More allocations ⚠️
More allocations ⚠️ in #7879
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1
248.25 KB
272.94 KB
24.7 KB
9.95%
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 | 248.25 KB | 272.94 KB | 24.7 KB | 9.95% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StringConcatBenchmark |
net6.0 | 45.3μs | 235ns | 1.08μs | 0 | 0 | 0 | 42.51 KB |
| master | StringConcatBenchmark |
netcoreapp3.1 | 49.7μs | 282ns | 1.99μs | 0 | 0 | 0 | 42.54 KB |
| master | StringConcatBenchmark |
net472 | 57μs | 299ns | 1.49μs | 0 | 0 | 0 | 49.15 KB |
| master | StringConcatAspectBenchmark |
net6.0 | 476μs | 1.66μs | 8.8μs | 0 | 0 | 0 | 272.65 KB |
| master | StringConcatAspectBenchmark |
netcoreapp3.1 | 434μs | 6.43μs | 63.7μs | 0 | 0 | 0 | 248.25 KB |
| master | StringConcatAspectBenchmark |
net472 | 396μs | 1.31μs | 4.72μs | 0 | 0 | 0 | 270.34 KB |
| #7879 | StringConcatBenchmark |
net6.0 | 44.4μs | 203ns | 1.2μs | 0 | 0 | 0 | 42.51 KB |
| #7879 | StringConcatBenchmark |
netcoreapp3.1 | 50.7μs | 296ns | 2.6μs | 0 | 0 | 0 | 42.54 KB |
| #7879 | StringConcatBenchmark |
net472 | 57.1μs | 272ns | 1.12μs | 0 | 0 | 0 | 49.15 KB |
| #7879 | StringConcatAspectBenchmark |
net6.0 | 482μs | 2.11μs | 7.62μs | 0 | 0 | 0 | 272.92 KB |
| #7879 | StringConcatAspectBenchmark |
netcoreapp3.1 | 468μs | 6.58μs | 65.1μs | 0 | 0 | 0 | 272.94 KB |
| #7879 | StringConcatAspectBenchmark |
net472 | 394μs | 1.58μs | 5.92μs | 0 | 0 | 0 | 270.34 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 | 2.64μs | 13.8ns | 64.9ns | 0 | 0 | 0 | 1.69 KB |
| master | EnrichedLog |
netcoreapp3.1 | 3.63μs | 1.96ns | 7.59ns | 0 | 0 | 0 | 1.7 KB |
| master | EnrichedLog |
net472 | 3.77μs | 4.73ns | 18.3ns | 0.245 | 0 | 0 | 1.6 KB |
| #7879 | EnrichedLog |
net6.0 | 2.74μs | 3.6ns | 13.9ns | 0 | 0 | 0 | 1.69 KB |
| #7879 | EnrichedLog |
netcoreapp3.1 | 3.52μs | 16.9ns | 69.8ns | 0 | 0 | 0 | 1.7 KB |
| #7879 | EnrichedLog |
net472 | 3.85μs | 4.25ns | 16.5ns | 0.251 | 0 | 0 | 1.6 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 | 134μs | 723ns | 3.96μs | 0 | 0 | 0 | 4.31 KB |
| master | EnrichedLog |
netcoreapp3.1 | 138μs | 704ns | 3.15μs | 0 | 0 | 0 | 4.31 KB |
| master | EnrichedLog |
net472 | 168μs | 779ns | 3.48μs | 0 | 0 | 0 | 4.51 KB |
| #7879 | EnrichedLog |
net6.0 | 122μs | 74.2ns | 288ns | 0 | 0 | 0 | 4.31 KB |
| #7879 | EnrichedLog |
netcoreapp3.1 | 127μs | 196ns | 734ns | 0 | 0 | 0 | 4.31 KB |
| #7879 | EnrichedLog |
net472 | 168μs | 103ns | 399ns | 0 | 0 | 0 | 4.51 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 | 5.05μs | 5.03ns | 19.5ns | 0 | 0 | 0 | 2.24 KB |
| master | EnrichedLog |
netcoreapp3.1 | 6.89μs | 18.8ns | 67.9ns | 0 | 0 | 0 | 2.26 KB |
| master | EnrichedLog |
net472 | 7.59μs | 5.38ns | 20.1ns | 0.302 | 0 | 0 | 2.05 KB |
| #7879 | EnrichedLog |
net6.0 | 5.03μs | 16.3ns | 63.1ns | 0 | 0 | 0 | 2.24 KB |
| #7879 | EnrichedLog |
netcoreapp3.1 | 6.74μs | 15.6ns | 60.4ns | 0 | 0 | 0 | 2.26 KB |
| #7879 | EnrichedLog |
net472 | 7.52μs | 5.85ns | 22.6ns | 0.303 | 0 | 0 | 2.05 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.87μs | 10.4ns | 61.6ns | 0 | 0 | 0 | 1.12 KB |
| master | SendReceive |
netcoreapp3.1 | 2.59μs | 11.2ns | 43.3ns | 0 | 0 | 0 | 1.14 KB |
| master | SendReceive |
net472 | 2.82μs | 2.14ns | 8.03ns | 0.169 | 0 | 0 | 1.12 KB |
| #7879 | SendReceive |
net6.0 | 1.96μs | 9.41ns | 37.6ns | 0 | 0 | 0 | 1.12 KB |
| #7879 | SendReceive |
netcoreapp3.1 | 2.58μs | 12.3ns | 49.3ns | 0 | 0 | 0 | 1.14 KB |
| #7879 | SendReceive |
net472 | 3.1μs | 2.78ns | 10.8ns | 0.17 | 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 | 4.28μs | 6.24ns | 24.2ns | 0 | 0 | 0 | 1.58 KB |
| master | EnrichedLog |
netcoreapp3.1 | 5.77μs | 10.2ns | 38.3ns | 0 | 0 | 0 | 1.63 KB |
| master | EnrichedLog |
net472 | 6.58μs | 6.82ns | 26.4ns | 0.296 | 0 | 0 | 2.03 KB |
| #7879 | EnrichedLog |
net6.0 | 4.32μs | 4.64ns | 18ns | 0 | 0 | 0 | 1.58 KB |
| #7879 | EnrichedLog |
netcoreapp3.1 | 5.71μs | 2.5ns | 9.7ns | 0 | 0 | 0 | 1.63 KB |
| #7879 | EnrichedLog |
net472 | 6.58μs | 7.4ns | 28.7ns | 0.294 | 0 | 0 | 2.03 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 | 773ns | 3.83ns | 15.8ns | 0 | 0 | 0 | 520 B |
| master | StartFinishSpan |
netcoreapp3.1 | 963ns | 5.18ns | 26.4ns | 0 | 0 | 0 | 520 B |
| master | StartFinishSpan |
net472 | 908ns | 0.376ns | 1.41ns | 0.082 | 0 | 0 | 522 B |
| master | StartFinishScope |
net6.0 | 887ns | 4.55ns | 20.9ns | 0 | 0 | 0 | 640 B |
| master | StartFinishScope |
netcoreapp3.1 | 1.17μs | 4.97ns | 19.2ns | 0 | 0 | 0 | 640 B |
| master | StartFinishScope |
net472 | 1.11μs | 0.318ns | 1.19ns | 0.0949 | 0 | 0 | 602 B |
| master | StartFinishTwoScopes |
net6.0 | 1.81μs | 1.91ns | 7.13ns | 0 | 0 | 0 | 1.19 KB |
| master | StartFinishTwoScopes |
netcoreapp3.1 | 2.29μs | 3.38ns | 13.1ns | 0 | 0 | 0 | 1.19 KB |
| master | StartFinishTwoScopes |
net472 | 2.18μs | 0.462ns | 1.66ns | 0.163 | 0 | 0 | 1.08 KB |
| #7879 | StartFinishSpan |
net6.0 | 768ns | 3.62ns | 14ns | 0 | 0 | 0 | 520 B |
| #7879 | StartFinishSpan |
netcoreapp3.1 | 964ns | 0.445ns | 1.72ns | 0 | 0 | 0 | 520 B |
| #7879 | StartFinishSpan |
net472 | 896ns | 0.0415ns | 0.155ns | 0.0809 | 0 | 0 | 522 B |
| #7879 | StartFinishScope |
net6.0 | 924ns | 4.48ns | 19ns | 0 | 0 | 0 | 640 B |
| #7879 | StartFinishScope |
netcoreapp3.1 | 1.15μs | 6ns | 29.4ns | 0 | 0 | 0 | 641 B |
| #7879 | StartFinishScope |
net472 | 1.12μs | 3.59ns | 13.9ns | 0.095 | 0 | 0 | 602 B |
| #7879 | StartFinishTwoScopes |
net6.0 | 1.77μs | 8.72ns | 40.9ns | 0 | 0 | 0 | 1.19 KB |
| #7879 | StartFinishTwoScopes |
netcoreapp3.1 | 2.2μs | 11.2ns | 53.6ns | 0 | 0 | 0 | 1.19 KB |
| #7879 | StartFinishTwoScopes |
net472 | 2.13μs | 0.721ns | 2.7ns | 0.17 | 0 | 0 | 1.08 KB |
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | RunOnMethodBegin |
net6.0 | 1.07μs | 5.19ns | 21.4ns | 0 | 0 | 0 | 640 B |
| master | RunOnMethodBegin |
netcoreapp3.1 | 1.38μs | 7.31ns | 36.6ns | 0 | 0 | 0 | 640 B |
| master | RunOnMethodBegin |
net472 | 1.45μs | 0.578ns | 2.24ns | 0.0945 | 0 | 0 | 602 B |
| #7879 | RunOnMethodBegin |
net6.0 | 1.05μs | 3.9ns | 15.1ns | 0 | 0 | 0 | 640 B |
| #7879 | RunOnMethodBegin |
netcoreapp3.1 | 1.4μs | 7.01ns | 29.7ns | 0 | 0 | 0 | 640 B |
| #7879 | RunOnMethodBegin |
net472 | 1.45μs | 0.389ns | 1.45ns | 0.094 | 0 | 0 | 602 B |
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (7879) 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 (7879) - mean (76ms) : 70, 82
master - mean (76ms) : 71, 80
section Bailout
This PR (7879) - mean (80ms) : 74, 85
master - mean (80ms) : 74, 86
section CallTarget+Inlining+NGEN
This PR (7879) - mean (1,075ms) : 1008, 1143
master - mean (1,064ms) : 1004, 1123
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 (7879) - mean (120ms) : 111, 129
master - mean (118ms) : 111, 125
section Bailout
This PR (7879) - mean (120ms) : 112, 129
master - mean (120ms) : 114, 126
section CallTarget+Inlining+NGEN
This PR (7879) - mean (768ms) : 733, 803
master - mean (755ms) : 711, 800
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7879) - mean (107ms) : 98, 116
master - mean (106ms) : 100, 113
section Bailout
This PR (7879) - mean (107ms) : 100, 113
master - mean (107ms) : 99, 114
section CallTarget+Inlining+NGEN
This PR (7879) - mean (718ms) : 674, 762
master - mean (706ms) : 679, 733
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7879) - mean (104ms) : 97, 111
master - mean (104ms) : 96, 112
section Bailout
This PR (7879) - mean (107ms) : 97, 116
master - mean (105ms) : 99, 111
section CallTarget+Inlining+NGEN
This PR (7879) - mean (685ms) : 650, 720
master - mean (675ms) : 644, 705
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 (7879) - mean (195ms) : 190, 200
master - mean (192ms) : 188, 197
section Bailout
This PR (7879) - mean (198ms) : 193, 202
master - mean (195ms) : 192, 198
section CallTarget+Inlining+NGEN
This PR (7879) - mean (1,136ms) : 1066, 1206
master - mean (1,115ms) : 1053, 1176
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 (7879) - mean (278ms) : 273, 284
master - mean (276ms) : 271, 280
section Bailout
This PR (7879) - mean (278ms) : 274, 281
master - mean (276ms) : 272, 279
section CallTarget+Inlining+NGEN
This PR (7879) - mean (911ms) : 872, 951
master - mean (909ms) : 859, 959
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7879) - mean (272ms) : 266, 277
master - mean (269ms) : 264, 273
section Bailout
This PR (7879) - mean (270ms) : 267, 273
master - mean (269ms) : 264, 273
section CallTarget+Inlining+NGEN
This PR (7879) - mean (883ms) : 843, 922
master - mean (882ms) : 841, 923
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7879) - mean (272ms) : 267, 278
master - mean (268ms) : 263, 272
section Bailout
This PR (7879) - mean (272ms) : 264, 279
master - mean (268ms) : 264, 273
section CallTarget+Inlining+NGEN
This PR (7879) - mean (837ms) : 810, 864
master - mean (820ms) : 797, 842
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
8fd9a3d to
8b7dd42
Compare
222d5ac to
6f7e4ff
Compare
8b7dd42 to
611c512
Compare
Summary of changes
SealedAnalyzeradded in Add "Types should be sealed" analyzer #7878 frominfotowarningfor specific projectsReason for change
As described in
#7878, making typessealedcan have performance benefits. It's basically a free small perf bump, and there's not really any downsides.Implementation details
After writing the analyzer, I got claude code to fix all the violations. Annoyingly,
dotnet formatdoesn't seem to work with this analyzer because it's a "compilation end" analyzer.Then I went through all the changes and confirmed they're valid. I also changed a bunch to
staticwhere they were stateless and effectively should have been static.I have written some comments on the PR for places where we had to explicitly ignore, but GitHub can't handle it, so here's some others 😅
Tracer- had to not marked this sealed, because we derive from it in tests 🙁 This one is very annoying, I may try to fix in a subsequent PR.DirectSubmissionLogSink- we were deriving from this in tests so that we could call a protected method, so just added a way to call that instead.PerformanceCountersListener- we derive from this in tests.Test coverage
As long as everything passes, we should be good 🤞
Other details
Stacked on
https://datadoghq.atlassian.net/browse/LANGPLAT-813