-
Notifications
You must be signed in to change notification settings - Fork 150
Reduce allocations in TraceContext
#7874
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
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ 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".
BenchmarksBenchmarks Report for benchmark platform 🐌Benchmarks for #7874 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‑netcoreapp3.1 | 5.72 KB | 5.59 KB | -131 B | -2.29% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StartStopWithChild |
net6.0 | 10.5μs | 56.6ns | 330ns | 0 | 0 | 0 | 5.5 KB |
| master | StartStopWithChild |
netcoreapp3.1 | 13.5μs | 68.5ns | 306ns | 0 | 0 | 0 | 5.72 KB |
| master | StartStopWithChild |
net472 | 21.8μs | 79.6ns | 298ns | 0.87 | 0.217 | 0 | 6 KB |
| #7874 | StartStopWithChild |
net6.0 | 10.9μs | 59.3ns | 325ns | 0 | 0 | 0 | 5.51 KB |
| #7874 | StartStopWithChild |
netcoreapp3.1 | 14.6μs | 53.9ns | 209ns | 0 | 0 | 0 | 5.59 KB |
| #7874 | StartStopWithChild |
net472 | 22.3μs | 121ns | 704ns | 0.891 | 0.223 | 0 | 5.98 KB |
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ More allocations ⚠️
More allocations ⚠️ in #7874
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces‑net472
3.26 KB
3.39 KB
128 B
3.92%
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 | 3.26 KB | 3.39 KB | 128 B | 3.92% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | WriteAndFlushEnrichedTraces |
net6.0 | 1.25ms | 206ns | 770ns | 0 | 0 | 0 | 2.7 KB |
| master | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 1.39ms | 79.6ns | 308ns | 0 | 0 | 0 | 2.7 KB |
| master | WriteAndFlushEnrichedTraces |
net472 | 1.76ms | 1.26μs | 4.86μs | 0 | 0 | 0 | 3.26 KB |
| #7874 | WriteAndFlushEnrichedTraces |
net6.0 | 1.27ms | 390ns | 1.51μs | 0 | 0 | 0 | 2.7 KB |
| #7874 | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 1.37ms | 722ns | 2.8μs | 0 | 0 | 0 | 2.7 KB |
| #7874 | WriteAndFlushEnrichedTraces |
net472 | 1.73ms | 887ns | 3.44μs | 0 | 0 | 0 | 3.39 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.09μs | 6.08ns | 39.9ns | 0 | 0 | 0 | 1.22 KB |
| master | AllCycleSimpleBody |
netcoreapp3.1 | 1.38μs | 7.76ns | 53.2ns | 0 | 0 | 0 | 1.2 KB |
| master | AllCycleSimpleBody |
net472 | 1μs | 0.238ns | 0.922ns | 0.191 | 0 | 0 | 1.23 KB |
| master | AllCycleMoreComplexBody |
net6.0 | 7.32μs | 36.7ns | 168ns | 0 | 0 | 0 | 4.72 KB |
| master | AllCycleMoreComplexBody |
netcoreapp3.1 | 8.88μs | 46.5ns | 237ns | 0 | 0 | 0 | 4.62 KB |
| master | AllCycleMoreComplexBody |
net472 | 7.7μs | 4.23ns | 16.4ns | 0.731 | 0 | 0 | 4.74 KB |
| master | ObjectExtractorSimpleBody |
net6.0 | 317ns | 0.0977ns | 0.366ns | 0 | 0 | 0 | 280 B |
| master | ObjectExtractorSimpleBody |
netcoreapp3.1 | 395ns | 2.17ns | 13.4ns | 0 | 0 | 0 | 272 B |
| master | ObjectExtractorSimpleBody |
net472 | 300ns | 0.0108ns | 0.0402ns | 0.0439 | 0 | 0 | 281 B |
| master | ObjectExtractorMoreComplexBody |
net6.0 | 6.34μs | 29.4ns | 118ns | 0 | 0 | 0 | 3.78 KB |
| master | ObjectExtractorMoreComplexBody |
netcoreapp3.1 | 7.82μs | 36.6ns | 142ns | 0 | 0 | 0 | 3.69 KB |
| master | ObjectExtractorMoreComplexBody |
net472 | 6.68μs | 2.21ns | 8.56ns | 0.602 | 0 | 0 | 3.8 KB |
| #7874 | AllCycleSimpleBody |
net6.0 | 1.11μs | 2.8ns | 10.8ns | 0 | 0 | 0 | 1.22 KB |
| #7874 | AllCycleSimpleBody |
netcoreapp3.1 | 1.47μs | 4.72ns | 18.3ns | 0 | 0 | 0 | 1.2 KB |
| #7874 | AllCycleSimpleBody |
net472 | 1.02μs | 0.54ns | 2.09ns | 0.194 | 0 | 0 | 1.23 KB |
| #7874 | AllCycleMoreComplexBody |
net6.0 | 7.23μs | 35.8ns | 139ns | 0 | 0 | 0 | 4.72 KB |
| #7874 | AllCycleMoreComplexBody |
netcoreapp3.1 | 9.17μs | 46ns | 206ns | 0 | 0 | 0 | 4.62 KB |
| #7874 | AllCycleMoreComplexBody |
net472 | 7.61μs | 6.01ns | 23.3ns | 0.724 | 0 | 0 | 4.74 KB |
| #7874 | ObjectExtractorSimpleBody |
net6.0 | 321ns | 1.68ns | 7.15ns | 0 | 0 | 0 | 280 B |
| #7874 | ObjectExtractorSimpleBody |
netcoreapp3.1 | 394ns | 2.18ns | 12.4ns | 0 | 0 | 0 | 272 B |
| #7874 | ObjectExtractorSimpleBody |
net472 | 296ns | 0.0368ns | 0.138ns | 0.0432 | 0 | 0 | 281 B |
| #7874 | ObjectExtractorMoreComplexBody |
net6.0 | 6.35μs | 28.8ns | 111ns | 0 | 0 | 0 | 3.78 KB |
| #7874 | ObjectExtractorMoreComplexBody |
netcoreapp3.1 | 7.87μs | 37.2ns | 154ns | 0 | 0 | 0 | 3.69 KB |
| #7874 | ObjectExtractorMoreComplexBody |
net472 | 6.7μs | 4.53ns | 17.5ns | 0.571 | 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.3μs | 299ns | 1.12μs | 0 | 0 | 0 | 32.4 KB |
| master | EncodeArgs |
netcoreapp3.1 | 97.9μs | 379ns | 1.47μs | 0 | 0 | 0 | 32.4 KB |
| master | EncodeArgs |
net472 | 108μs | 14ns | 54.2ns | 4.87 | 0 | 0 | 32.5 KB |
| master | EncodeLegacyArgs |
net6.0 | 142μs | 34.7ns | 134ns | 0 | 0 | 0 | 2.14 KB |
| master | EncodeLegacyArgs |
netcoreapp3.1 | 198μs | 26.2ns | 98.1ns | 0 | 0 | 0 | 2.14 KB |
| master | EncodeLegacyArgs |
net472 | 263μs | 42.9ns | 166ns | 0 | 0 | 0 | 2.14 KB |
| #7874 | EncodeArgs |
net6.0 | 76.2μs | 284ns | 1.1μs | 0 | 0 | 0 | 32.4 KB |
| #7874 | EncodeArgs |
netcoreapp3.1 | 97.9μs | 183ns | 707ns | 0 | 0 | 0 | 32.4 KB |
| #7874 | EncodeArgs |
net472 | 108μs | 18ns | 69.9ns | 4.89 | 0 | 0 | 32.5 KB |
| #7874 | EncodeLegacyArgs |
net6.0 | 146μs | 24.8ns | 96.2ns | 0 | 0 | 0 | 2.14 KB |
| #7874 | EncodeLegacyArgs |
netcoreapp3.1 | 201μs | 187ns | 724ns | 0 | 0 | 0 | 2.14 KB |
| #7874 | EncodeLegacyArgs |
net472 | 262μs | 23.4ns | 90.7ns | 0 | 0 | 0 | 2.14 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 | 427μs | 2.14μs | 9.31μs | 0 | 0 | 0 | 4.55 KB |
| master | RunWafRealisticBenchmark |
netcoreapp3.1 | 464μs | 1.58μs | 5.9μs | 0 | 0 | 0 | 4.48 KB |
| master | RunWafRealisticBenchmark |
net472 | 496μs | 231ns | 834ns | 0 | 0 | 0 | 0 b |
| master | RunWafRealisticBenchmarkWithAttack |
net6.0 | 319μs | 1.47μs | 5.49μs | 0 | 0 | 0 | 2.24 KB |
| master | RunWafRealisticBenchmarkWithAttack |
netcoreapp3.1 | 347μs | 1.93μs | 13.6μs | 0 | 0 | 0 | 2.22 KB |
| master | RunWafRealisticBenchmarkWithAttack |
net472 | 368μs | 493ns | 1.78μs | 0 | 0 | 0 | 0 b |
| #7874 | RunWafRealisticBenchmark |
net6.0 | 432μs | 1.37μs | 4.92μs | 0 | 0 | 0 | 4.55 KB |
| #7874 | RunWafRealisticBenchmark |
netcoreapp3.1 | 465μs | 3.47μs | 32.9μs | 0 | 0 | 0 | 4.48 KB |
| #7874 | RunWafRealisticBenchmark |
net472 | 495μs | 481ns | 1.73μs | 0 | 0 | 0 | 0 b |
| #7874 | RunWafRealisticBenchmarkWithAttack |
net6.0 | 321μs | 1.84μs | 14.9μs | 0 | 0 | 0 | 2.24 KB |
| #7874 | RunWafRealisticBenchmarkWithAttack |
netcoreapp3.1 | 362μs | 3.49μs | 33.9μs | 0 | 0 | 0 | 2.22 KB |
| #7874 | RunWafRealisticBenchmarkWithAttack |
net472 | 371μs | 352ns | 1.27μs | 0 | 0 | 0 | 0 b |
Benchmarks.Trace.AspNetCoreBenchmark - Unknown 🤷 Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendRequest |
net6.0 | 84μs | 75.5ns | 292ns | 0 | 0 | 0 | 19.03 KB |
| master | SendRequest |
netcoreapp3.1 | 97μs | 364ns | 2.03μs | 0 | 0 | 0 | 21.25 KB |
| master | SendRequest |
net472 | 0ns | 0ns | 0ns | 0 | 0 | 0 | 0 b |
| #7874 | SendRequest |
net6.0 | 85.4μs | 315ns | 1.89μs | 0 | 0 | 0 | 18.97 KB |
| #7874 | SendRequest |
netcoreapp3.1 | 97μs | 91.8ns | 318ns | 0 | 0 | 0 | 21.18 KB |
| #7874 | 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 | 1.91ms | 1.86μs | 7.21μs | 0 | 0 | 0 | 640 KB |
| master | OriginalCharSlice |
netcoreapp3.1 | 3.93ms | 877ns | 3.39μs | 0 | 0 | 0 | 640.05 KB |
| master | OriginalCharSlice |
net472 | 2.58ms | 442ns | 1.65μs | 0 | 0 | 0 | 638.98 KB |
| master | OptimizedCharSlice |
net6.0 | 1.45ms | 3.25μs | 12.6μs | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSlice |
netcoreapp3.1 | 2.73ms | 996ns | 3.45μs | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSlice |
net472 | 1.95ms | 957ns | 3.58μs | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSliceWithPool |
net6.0 | 1.05ms | 691ns | 2.68μs | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSliceWithPool |
netcoreapp3.1 | 1.85ms | 1.99μs | 7.7μs | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSliceWithPool |
net472 | 1.16ms | 710ns | 2.75μs | 0 | 0 | 0 | 0 b |
| #7874 | OriginalCharSlice |
net6.0 | 2.02ms | 2.02μs | 7.58μs | 0 | 0 | 0 | 640 KB |
| #7874 | OriginalCharSlice |
netcoreapp3.1 | 3.9ms | 2.55μs | 9.19μs | 0 | 0 | 0 | 640.05 KB |
| #7874 | OriginalCharSlice |
net472 | 2.6ms | 757ns | 2.93μs | 0 | 0 | 0 | 638.98 KB |
| #7874 | OptimizedCharSlice |
net6.0 | 1.44ms | 894ns | 3.46μs | 0 | 0 | 0 | 0 b |
| #7874 | OptimizedCharSlice |
netcoreapp3.1 | 2.75ms | 1.55μs | 6μs | 0 | 0 | 0 | 0 b |
| #7874 | OptimizedCharSlice |
net472 | 1.9ms | 774ns | 3μs | 0 | 0 | 0 | 0 b |
| #7874 | OptimizedCharSliceWithPool |
net6.0 | 1.09ms | 651ns | 2.44μs | 0 | 0 | 0 | 0 b |
| #7874 | OptimizedCharSliceWithPool |
netcoreapp3.1 | 1.88ms | 1.59μs | 6.16μs | 0 | 0 | 0 | 0 b |
| #7874 | OptimizedCharSliceWithPool |
net472 | 1.17ms | 559ns | 2.09μs | 0 | 0 | 0 | 0 b |
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Slower ⚠️ More allocations ⚠️
Slower ⚠️ in #7874
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1
1.178
690,077.92
812,952.94
More allocations ⚠️ in #7874
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0
41.68 KB
42 KB
318 B
0.76%
| Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 | 1.178 | 690,077.92 | 812,952.94 |
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 | 41.68 KB | 42 KB | 318 B | 0.76% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | WriteAndFlushEnrichedTraces |
net6.0 | 761μs | 1.44μs | 5.57μs | 0 | 0 | 0 | 41.68 KB |
| master | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 700μs | 3.64μs | 17.8μs | 0 | 0 | 0 | 41.8 KB |
| master | WriteAndFlushEnrichedTraces |
net472 | 892μs | 3.52μs | 13.6μs | 4.46 | 0 | 0 | 55.79 KB |
| #7874 | WriteAndFlushEnrichedTraces |
net6.0 | 747μs | 1.43μs | 5.16μs | 0 | 0 | 0 | 42 KB |
| #7874 | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 814μs | 1.91μs | 6.9μs | 0 | 0 | 0 | 41.89 KB |
| #7874 | WriteAndFlushEnrichedTraces |
net472 | 868μs | 3.85μs | 15.4μs | 4.46 | 0 | 0 | 55.87 KB |
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Fewer allocations 🎉
Fewer allocations 🎉 in #7874
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑net6.0
1.02 KB
968 B
-56 B
-5.47%
Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑netcoreapp3.1
1.02 KB
960 B
-56 B
-5.51%
Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑net472
987 B
931 B
-56 B
-5.67%
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑net6.0 | 1.02 KB | 968 B | -56 B | -5.47% |
| Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑netcoreapp3.1 | 1.02 KB | 960 B | -56 B | -5.51% |
| Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑net472 | 987 B | 931 B | -56 B | -5.67% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | ExecuteNonQuery |
net6.0 | 1.86μs | 7.27ns | 28.2ns | 0 | 0 | 0 | 1.02 KB |
| master | ExecuteNonQuery |
netcoreapp3.1 | 2.57μs | 6.77ns | 26.2ns | 0 | 0 | 0 | 1.02 KB |
| master | ExecuteNonQuery |
net472 | 2.79μs | 3.48ns | 13.5ns | 0.15 | 0 | 0 | 987 B |
| #7874 | ExecuteNonQuery |
net6.0 | 1.98μs | 2.89ns | 10.8ns | 0 | 0 | 0 | 968 B |
| #7874 | ExecuteNonQuery |
netcoreapp3.1 | 2.52μs | 9.81ns | 36.7ns | 0 | 0 | 0 | 960 B |
| #7874 | ExecuteNonQuery |
net472 | 2.69μs | 1.77ns | 6.64ns | 0.135 | 0 | 0 | 931 B |
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Fewer allocations 🎉
Fewer allocations 🎉 in #7874
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑netcoreapp3.1
1.07 KB
1.02 KB
-56 B
-5.22%
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑net472
1.07 KB
1.01 KB
-56 B
-5.25%
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑netcoreapp3.1
1.02 KB
968 B
-56 B
-5.47%
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑net472
1.01 KB
955 B
-56 B
-5.54%
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑net6.0
1.01 KB
952 B
-56 B
-5.56%
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑net6.0
984 B
928 B
-56 B
-5.69%
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑netcoreapp3.1 | 1.07 KB | 1.02 KB | -56 B | -5.22% |
| Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑net472 | 1.07 KB | 1.01 KB | -56 B | -5.25% |
| Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑netcoreapp3.1 | 1.02 KB | 968 B | -56 B | -5.47% |
| Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑net472 | 1.01 KB | 955 B | -56 B | -5.54% |
| Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑net6.0 | 1.01 KB | 952 B | -56 B | -5.56% |
| Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑net6.0 | 984 B | 928 B | -56 B | -5.69% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | CallElasticsearch |
net6.0 | 1.67μs | 8.33ns | 36.3ns | 0 | 0 | 0 | 1.01 KB |
| master | CallElasticsearch |
netcoreapp3.1 | 2.27μs | 9.56ns | 37ns | 0 | 0 | 0 | 1.02 KB |
| master | CallElasticsearch |
net472 | 3.4μs | 3.1ns | 11.6ns | 0.154 | 0 | 0 | 1.01 KB |
| master | CallElasticsearchAsync |
net6.0 | 1.76μs | 8.62ns | 35.5ns | 0 | 0 | 0 | 984 B |
| master | CallElasticsearchAsync |
netcoreapp3.1 | 2.46μs | 10.8ns | 41.9ns | 0 | 0 | 0 | 1.07 KB |
| master | CallElasticsearchAsync |
net472 | 3.55μs | 1.58ns | 5.9ns | 0.159 | 0 | 0 | 1.07 KB |
| #7874 | CallElasticsearch |
net6.0 | 1.65μs | 7.19ns | 27.9ns | 0 | 0 | 0 | 952 B |
| #7874 | CallElasticsearch |
netcoreapp3.1 | 2.29μs | 1.67ns | 6.45ns | 0 | 0 | 0 | 968 B |
| #7874 | CallElasticsearch |
net472 | 3.26μs | 3.16ns | 11.8ns | 0.147 | 0 | 0 | 955 B |
| #7874 | CallElasticsearchAsync |
net6.0 | 1.82μs | 9.64ns | 47.2ns | 0 | 0 | 0 | 928 B |
| #7874 | CallElasticsearchAsync |
netcoreapp3.1 | 2.4μs | 9.92ns | 38.4ns | 0 | 0 | 0 | 1.02 KB |
| #7874 | CallElasticsearchAsync |
net472 | 3.45μs | 2.56ns | 9.93ns | 0.154 | 0 | 0 | 1.01 KB |
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Fewer allocations 🎉
Fewer allocations 🎉 in #7874
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑netcoreapp3.1
952 B
896 B
-56 B
-5.88%
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net6.0
953 B
896 B
-57 B
-5.98%
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net472
915 B
859 B
-56 B
-6.12%
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑netcoreapp3.1 | 952 B | 896 B | -56 B | -5.88% |
| Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net6.0 | 953 B | 896 B | -57 B | -5.98% |
| Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net472 | 915 B | 859 B | -56 B | -6.12% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | ExecuteAsync |
net6.0 | 1.91μs | 9.42ns | 38.8ns | 0 | 0 | 0 | 953 B |
| master | ExecuteAsync |
netcoreapp3.1 | 2.5μs | 7.36ns | 28.5ns | 0 | 0 | 0 | 952 B |
| master | ExecuteAsync |
net472 | 2.63μs | 2.29ns | 8.86ns | 0.144 | 0 | 0 | 915 B |
| #7874 | ExecuteAsync |
net6.0 | 1.89μs | 3.9ns | 14.6ns | 0 | 0 | 0 | 896 B |
| #7874 | ExecuteAsync |
netcoreapp3.1 | 2.47μs | 6.48ns | 25.1ns | 0 | 0 | 0 | 896 B |
| #7874 | ExecuteAsync |
net472 | 2.58μs | 2.24ns | 8.66ns | 0.129 | 0 | 0 | 859 B |
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Fewer allocations 🎉
Fewer allocations 🎉 in #7874
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.HttpClientBenchmark.SendAsync‑net472
3.14 KB
3.08 KB
-56 B
-1.79%
Benchmarks.Trace.HttpClientBenchmark.SendAsync‑netcoreapp3.1
2.89 KB
2.83 KB
-56 B
-1.94%
Benchmarks.Trace.HttpClientBenchmark.SendAsync‑net6.0
2.34 KB
2.29 KB
-56 B
-2.39%
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.HttpClientBenchmark.SendAsync‑net472 | 3.14 KB | 3.08 KB | -56 B | -1.79% |
| Benchmarks.Trace.HttpClientBenchmark.SendAsync‑netcoreapp3.1 | 2.89 KB | 2.83 KB | -56 B | -1.94% |
| Benchmarks.Trace.HttpClientBenchmark.SendAsync‑net6.0 | 2.34 KB | 2.29 KB | -56 B | -2.39% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendAsync |
net6.0 | 6.89μs | 23.4ns | 90.8ns | 0 | 0 | 0 | 2.34 KB |
| master | SendAsync |
netcoreapp3.1 | 8.46μs | 24.9ns | 89.7ns | 0 | 0 | 0 | 2.89 KB |
| master | SendAsync |
net472 | 12.2μs | 9.27ns | 34.7ns | 0.489 | 0 | 0 | 3.14 KB |
| #7874 | SendAsync |
net6.0 | 7.09μs | 31.4ns | 122ns | 0 | 0 | 0 | 2.29 KB |
| #7874 | SendAsync |
netcoreapp3.1 | 8.44μs | 18.9ns | 73.4ns | 0 | 0 | 0 | 2.83 KB |
| #7874 | SendAsync |
net472 | 12μs | 7.81ns | 30.2ns | 0.48 | 0 | 0 | 3.08 KB |
Benchmarks.Trace.Iast.StringAspectsBenchmark - Slower ⚠️ Fewer allocations 🎉
Slower ⚠️ in #7874
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1
1.158
419,750.00
486,100.00
several?
Fewer allocations 🎉 in #7874
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1
257.52 KB
254.78 KB
-2.74 KB
-1.06%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0
273.92 KB
247.62 KB
-26.3 KB
-9.60%
| Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 | 1.158 | 419,750.00 | 486,100.00 | several? |
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 | 257.52 KB | 254.78 KB | -2.74 KB | -1.06% |
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 | 273.92 KB | 247.62 KB | -26.3 KB | -9.60% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StringConcatBenchmark |
net6.0 | 44.9μs | 266ns | 2.39μs | 0 | 0 | 0 | 42.51 KB |
| master | StringConcatBenchmark |
netcoreapp3.1 | 50.7μs | 327ns | 3.09μs | 0 | 0 | 0 | 42.54 KB |
| master | StringConcatBenchmark |
net472 | 56.4μs | 290ns | 1.3μs | 0 | 0 | 0 | 49.15 KB |
| master | StringConcatAspectBenchmark |
net6.0 | 485μs | 2.34μs | 9.37μs | 0 | 0 | 0 | 273.92 KB |
| master | StringConcatAspectBenchmark |
netcoreapp3.1 | 434μs | 5.13μs | 50.3μs | 0 | 0 | 0 | 257.52 KB |
| master | StringConcatAspectBenchmark |
net472 | 411μs | 2.37μs | 18.3μs | 0 | 0 | 0 | 270.34 KB |
| #7874 | StringConcatBenchmark |
net6.0 | 44.8μs | 251ns | 1.71μs | 0 | 0 | 0 | 42.51 KB |
| #7874 | StringConcatBenchmark |
netcoreapp3.1 | 50.3μs | 232ns | 1.29μs | 0 | 0 | 0 | 42.54 KB |
| #7874 | StringConcatBenchmark |
net472 | 57.3μs | 142ns | 512ns | 0 | 0 | 0 | 49.15 KB |
| #7874 | StringConcatAspectBenchmark |
net6.0 | 447μs | 2.11μs | 7.89μs | 0 | 0 | 0 | 247.62 KB |
| #7874 | StringConcatAspectBenchmark |
netcoreapp3.1 | 488μs | 1.83μs | 7.96μs | 0 | 0 | 0 | 254.78 KB |
| #7874 | StringConcatAspectBenchmark |
net472 | 406μs | 2.1μs | 9.63μ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.71μs | 13.2ns | 57.7ns | 0 | 0 | 0 | 1.69 KB |
| master | EnrichedLog |
netcoreapp3.1 | 3.53μs | 4.87ns | 18.9ns | 0 | 0 | 0 | 1.7 KB |
| master | EnrichedLog |
net472 | 3.85μs | 2.27ns | 8.81ns | 0.251 | 0 | 0 | 1.6 KB |
| #7874 | EnrichedLog |
net6.0 | 2.73μs | 13.1ns | 52.2ns | 0 | 0 | 0 | 1.69 KB |
| #7874 | EnrichedLog |
netcoreapp3.1 | 3.67μs | 1.99ns | 7.45ns | 0 | 0 | 0 | 1.7 KB |
| #7874 | EnrichedLog |
net472 | 3.83μs | 3.94ns | 15.2ns | 0.247 | 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 | 124μs | 53.6ns | 186ns | 0 | 0 | 0 | 4.31 KB |
| master | EnrichedLog |
netcoreapp3.1 | 129μs | 199ns | 718ns | 0 | 0 | 0 | 4.31 KB |
| master | EnrichedLog |
net472 | 168μs | 150ns | 580ns | 0 | 0 | 0 | 4.51 KB |
| #7874 | EnrichedLog |
net6.0 | 124μs | 125ns | 483ns | 0 | 0 | 0 | 4.31 KB |
| #7874 | EnrichedLog |
netcoreapp3.1 | 130μs | 257ns | 961ns | 0 | 0 | 0 | 4.31 KB |
| #7874 | EnrichedLog |
net472 | 172μs | 144ns | 559ns | 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.15μs | 20.2ns | 78.2ns | 0 | 0 | 0 | 2.24 KB |
| master | EnrichedLog |
netcoreapp3.1 | 6.95μs | 20.3ns | 78.6ns | 0 | 0 | 0 | 2.26 KB |
| master | EnrichedLog |
net472 | 7.55μs | 8.84ns | 34.2ns | 0.3 | 0 | 0 | 2.05 KB |
| #7874 | EnrichedLog |
net6.0 | 5.04μs | 14.2ns | 53ns | 0 | 0 | 0 | 2.24 KB |
| #7874 | EnrichedLog |
netcoreapp3.1 | 6.76μs | 15.8ns | 56.9ns | 0 | 0 | 0 | 2.26 KB |
| #7874 | EnrichedLog |
net472 | 7.7μs | 6.86ns | 26.6ns | 0.307 | 0 | 0 | 2.05 KB |
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Fewer allocations 🎉
Fewer allocations 🎉 in #7874
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.RedisBenchmark.SendReceive‑netcoreapp3.1
1.19 KB
1.14 KB
-56 B
-4.70%
Benchmarks.Trace.RedisBenchmark.SendReceive‑net6.0
1.18 KB
1.12 KB
-56 B
-4.76%
Benchmarks.Trace.RedisBenchmark.SendReceive‑net472
1.17 KB
1.12 KB
-56 B
-4.78%
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.RedisBenchmark.SendReceive‑netcoreapp3.1 | 1.19 KB | 1.14 KB | -56 B | -4.70% |
| Benchmarks.Trace.RedisBenchmark.SendReceive‑net6.0 | 1.18 KB | 1.12 KB | -56 B | -4.76% |
| Benchmarks.Trace.RedisBenchmark.SendReceive‑net472 | 1.17 KB | 1.12 KB | -56 B | -4.78% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendReceive |
net6.0 | 2μs | 0.614ns | 2.38ns | 0 | 0 | 0 | 1.18 KB |
| master | SendReceive |
netcoreapp3.1 | 2.65μs | 12.8ns | 54.2ns | 0 | 0 | 0 | 1.19 KB |
| master | SendReceive |
net472 | 2.95μs | 2.31ns | 8.94ns | 0.177 | 0 | 0 | 1.17 KB |
| #7874 | SendReceive |
net6.0 | 1.92μs | 6.67ns | 25.8ns | 0 | 0 | 0 | 1.12 KB |
| #7874 | SendReceive |
netcoreapp3.1 | 2.67μs | 12.3ns | 47.5ns | 0 | 0 | 0 | 1.14 KB |
| #7874 | SendReceive |
net472 | 2.86μs | 5.16ns | 20ns | 0.169 | 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.34μs | 4.31ns | 16.7ns | 0 | 0 | 0 | 1.58 KB |
| master | EnrichedLog |
netcoreapp3.1 | 5.44μs | 16.8ns | 65.1ns | 0 | 0 | 0 | 1.63 KB |
| master | EnrichedLog |
net472 | 6.59μs | 11.4ns | 44ns | 0.294 | 0 | 0 | 2.03 KB |
| #7874 | EnrichedLog |
net6.0 | 4.42μs | 4.44ns | 16.6ns | 0 | 0 | 0 | 1.58 KB |
| #7874 | EnrichedLog |
netcoreapp3.1 | 5.85μs | 17.9ns | 69.4ns | 0 | 0 | 0 | 1.63 KB |
| #7874 | EnrichedLog |
net472 | 6.52μs | 7.46ns | 27.9ns | 0.295 | 0 | 0 | 2.03 KB |
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Fewer allocations 🎉
Fewer allocations 🎉 in #7874
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0
696 B
640 B
-56 B
-8.05%
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑netcoreapp3.1
696 B
640 B
-56 B
-8.05%
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net472
658 B
602 B
-56 B
-8.51%
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net472
578 B
522 B
-56 B
-9.69%
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0
576 B
520 B
-56 B
-9.72%
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1
576 B
520 B
-56 B
-9.72%
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 | 696 B | 640 B | -56 B | -8.05% |
| Benchmarks.Trace.SpanBenchmark.StartFinishScope‑netcoreapp3.1 | 696 B | 640 B | -56 B | -8.05% |
| Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net472 | 658 B | 602 B | -56 B | -8.51% |
| Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net472 | 578 B | 522 B | -56 B | -9.69% |
| Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 | 576 B | 520 B | -56 B | -9.72% |
| Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 | 576 B | 520 B | -56 B | -9.72% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StartFinishSpan |
net6.0 | 798ns | 4.05ns | 17.7ns | 0 | 0 | 0 | 576 B |
| master | StartFinishSpan |
netcoreapp3.1 | 975ns | 5.14ns | 21.8ns | 0 | 0 | 0 | 576 B |
| master | StartFinishSpan |
net472 | 902ns | 0.0976ns | 0.365ns | 0.0907 | 0 | 0 | 578 B |
| master | StartFinishScope |
net6.0 | 946ns | 3.67ns | 13.7ns | 0 | 0 | 0 | 696 B |
| master | StartFinishScope |
netcoreapp3.1 | 1.16μs | 5.79ns | 24.6ns | 0 | 0 | 0 | 696 B |
| master | StartFinishScope |
net472 | 1.12μs | 0.553ns | 2.14ns | 0.101 | 0 | 0 | 658 B |
| master | StartFinishTwoScopes |
net6.0 | 1.78μs | 2.92ns | 11.3ns | 0 | 0 | 0 | 1.19 KB |
| master | StartFinishTwoScopes |
netcoreapp3.1 | 2.19μs | 11.3ns | 55.4ns | 0 | 0 | 0 | 1.19 KB |
| master | StartFinishTwoScopes |
net472 | 2.17μs | 2.55ns | 9.87ns | 0.162 | 0 | 0 | 1.08 KB |
| #7874 | StartFinishSpan |
net6.0 | 769ns | 3.69ns | 16.1ns | 0 | 0 | 0 | 520 B |
| #7874 | StartFinishSpan |
netcoreapp3.1 | 948ns | 4.91ns | 22.5ns | 0 | 0 | 0 | 520 B |
| #7874 | StartFinishSpan |
net472 | 890ns | 0.448ns | 1.74ns | 0.0799 | 0 | 0 | 522 B |
| #7874 | StartFinishScope |
net6.0 | 918ns | 1.26ns | 4.87ns | 0 | 0 | 0 | 640 B |
| #7874 | StartFinishScope |
netcoreapp3.1 | 1.13μs | 5.68ns | 25.4ns | 0 | 0 | 0 | 640 B |
| #7874 | StartFinishScope |
net472 | 1.11μs | 0.791ns | 2.96ns | 0.0947 | 0 | 0 | 602 B |
| #7874 | StartFinishTwoScopes |
net6.0 | 1.79μs | 9.53ns | 47.6ns | 0 | 0 | 0 | 1.19 KB |
| #7874 | StartFinishTwoScopes |
netcoreapp3.1 | 2.25μs | 8.56ns | 33.2ns | 0 | 0 | 0 | 1.19 KB |
| #7874 | StartFinishTwoScopes |
net472 | 2.13μs | 1.77ns | 6.85ns | 0.171 | 0 | 0 | 1.08 KB |
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Fewer allocations 🎉
Fewer allocations 🎉 in #7874
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0
696 B
640 B
-56 B
-8.05%
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑netcoreapp3.1
696 B
640 B
-56 B
-8.05%
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net472
658 B
602 B
-56 B
-8.51%
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 | 696 B | 640 B | -56 B | -8.05% |
| Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑netcoreapp3.1 | 696 B | 640 B | -56 B | -8.05% |
| Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net472 | 658 B | 602 B | -56 B | -8.51% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | RunOnMethodBegin |
net6.0 | 1.12μs | 5.98ns | 31.6ns | 0 | 0 | 0 | 696 B |
| master | RunOnMethodBegin |
netcoreapp3.1 | 1.42μs | 7.24ns | 33.2ns | 0 | 0 | 0 | 696 B |
| master | RunOnMethodBegin |
net472 | 1.49μs | 3.84ns | 14.9ns | 0.098 | 0 | 0 | 658 B |
| #7874 | RunOnMethodBegin |
net6.0 | 1.05μs | 4.96ns | 20.5ns | 0 | 0 | 0 | 640 B |
| #7874 | RunOnMethodBegin |
netcoreapp3.1 | 1.4μs | 6.29ns | 22.7ns | 0 | 0 | 0 | 640 B |
| #7874 | RunOnMethodBegin |
net472 | 1.44μs | 0.329ns | 1.27ns | 0.0938 | 0 | 0 | 602 B |
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (7874) 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 (7874) - mean (76ms) : 71, 81
master - mean (76ms) : 71, 81
section Bailout
This PR (7874) - mean (80ms) : 75, 84
master - mean (80ms) : 75, 85
section CallTarget+Inlining+NGEN
This PR (7874) - mean (1,077ms) : 995, 1160
master - mean (1,064ms) : 998, 1130
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 (7874) - mean (117ms) : 111, 123
master - mean (117ms) : 111, 122
section Bailout
This PR (7874) - mean (118ms) : 111, 125
master - mean (117ms) : 110, 125
section CallTarget+Inlining+NGEN
This PR (7874) - mean (755ms) : 707, 802
master - mean (758ms) : 718, 798
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7874) - mean (105ms) : 99, 111
master - mean (105ms) : 100, 110
section Bailout
This PR (7874) - mean (107ms) : 99, 115
master - mean (107ms) : 102, 112
section CallTarget+Inlining+NGEN
This PR (7874) - mean (708ms) : 682, 735
master - mean (703ms) : 672, 734
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7874) - mean (104ms) : 97, 111
master - mean (103ms) : 95, 110
section Bailout
This PR (7874) - mean (105ms) : 97, 112
master - mean (107ms) : 99, 115
section CallTarget+Inlining+NGEN
This PR (7874) - mean (686ms) : 645, 727
master - mean (684ms) : 642, 725
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 (7874) - mean (193ms) : 189, 197
master - mean (193ms) : 189, 197
section Bailout
This PR (7874) - mean (197ms) : 194, 199
master - mean (197ms) : 194, 199
section CallTarget+Inlining+NGEN
This PR (7874) - mean (1,116ms) : 1063, 1169
master - mean (1,116ms) : 1062, 1170
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 (7874) - mean (277ms) : 272, 282
master - mean (277ms) : 271, 283
section Bailout
This PR (7874) - mean (277ms) : 272, 283
master - mean (277ms) : 274, 281
section CallTarget+Inlining+NGEN
This PR (7874) - mean (902ms) : 856, 949
master - mean (911ms) : 865, 957
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7874) - mean (269ms) : 265, 274
master - mean (271ms) : 267, 275
section Bailout
This PR (7874) - mean (269ms) : 266, 273
master - mean (270ms) : 267, 274
section CallTarget+Inlining+NGEN
This PR (7874) - mean (884ms) : 841, 927
master - mean (885ms) : 845, 925
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7874) - mean (269ms) : 263, 274
master - mean (269ms) : 265, 272
section Bailout
This PR (7874) - mean (269ms) : 265, 272
master - mean (270ms) : 267, 273
section CallTarget+Inlining+NGEN
This PR (7874) - mean (827ms) : 810, 845
master - mean (827ms) : 806, 848
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
LGTM aside from the minor naming issues I commented on.
RootSpanshould be fixed (FirstSpan?)ToArray()... meh
Aside from reducing allocations, the resulting code looks much cleaner. Thanks!
This reverts commit 9b542fd6b89bfa0b31025d9587fd6f64df8aad03.
5ae4054 to
c02cbdb
Compare
anna-git
left a comment
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.
Nice!
## Summary of changes Add additional assembly to public API for unsafe to .NET Standard 2.0 ## Reason for change #7874 reduced the allocation in `TraceContext` and used `unsafe` code. Apparently this is a new assembly reference for < .NET Core 3.1, and because we don't run tests on .NET Core 2.1 (ever) or .NET Core 3.0 tests (on PRs), we missed it. ## Implementation details Added the assembly reference, and confirmed it passes for both .NET Core 2.1 and 3.0 now. ## Test coverage Covered by existing ## Other details Raises the question of whether we _should_ be testing one of those on PRs again, given there's whole code paths that go untouched otherwise 😅
Summary of changes
Replace
ArraySegment<Span>withSpanCollectionReason for change
ArraySegment<Span>is a wrapper around an array, and by design, always requires allocating an array.However, if we look at the distribution of traces received for processing, we see that 50% of traces only have a single span.
Consequently,
SpanCollectiontakes a similar approach toStringValues, in which it is an abstraction around either a singleSpanor aSpan[]. This means we can avoid allocating the array entirely until we need to.For small traces (with a single span), this saves 56 Bytes per scope/trace or ~8% of the basic trace size. For larger traces,
SpanCollectionandArraySegment<Span>are essentially identical, so the allocation is the same.Given
SpanCollection(andArraySegmentactually) arereadonly struct, also addedinto the signatures (given that both structs are the same size and > pointer size).Implementation details
The changes are essentially:
SpanCollectionholds either aSpanor aSpan[](ornull)StringValuesdoes), as it reduces the size of the struct which brings small perf benefitsinto reduce chance of defensive copiesin/reffields, and can't provide the same functionality as a stubTest coverage
Added some unit tests for the implementation, but the important thing is the benchmarks. We see an 8-8.5% reduction in the allocations for create span/create scope:
Other benchmarks which create a single span see similar improvements.
Note that the two scope benchmark (added in #7869) shows essentially no change (as expected).
Other details
I tried a variety of variations on this approach:
SpanandSpan[]inCountfield (and makeSpanCollectionpointer-sized)https://datadoghq.atlassian.net/browse/LANGPLAT-841