-
Notifications
You must be signed in to change notification settings - Fork 151
Fix benchmark flakiness #7790
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
Fix benchmark flakiness #7790
Conversation
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (7790) 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 (7790) - mean (77ms) : 70, 83
master - mean (75ms) : 70, 80
section Bailout
This PR (7790) - mean (82ms) : 74, 89
master - mean (79ms) : 74, 83
section CallTarget+Inlining+NGEN
This PR (7790) - mean (1,079ms) : 981, 1177
master - mean (1,067ms) : 986, 1147
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 (7790) - mean (121ms) : 112, 130
master - mean (118ms) : 110, 126
section Bailout
This PR (7790) - mean (122ms) : 114, 130
master - mean (120ms) : 112, 129
section CallTarget+Inlining+NGEN
This PR (7790) - mean (781ms) : 736, 826
master - mean (760ms) : 719, 800
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7790) - mean (107ms) : 99, 115
master - mean (105ms) : 99, 110
section Bailout
This PR (7790) - mean (109ms) : 99, 118
master - mean (106ms) : 101, 112
section CallTarget+Inlining+NGEN
This PR (7790) - mean (726ms) : 674, 778
master - mean (713ms) : 668, 758
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7790) - mean (105ms) : 97, 113
master - mean (105ms) : 97, 113
section Bailout
This PR (7790) - mean (107ms) : 99, 114
master - mean (106ms) : 101, 111
section CallTarget+Inlining+NGEN
This PR (7790) - mean (698ms) : 665, 731
master - mean (688ms) : 660, 716
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 (7790) - mean (194ms) : 190, 198
master - mean (193ms) : 189, 197
section Bailout
This PR (7790) - mean (198ms) : 193, 202
master - mean (196ms) : 193, 199
section CallTarget+Inlining+NGEN
This PR (7790) - mean (1,116ms) : 1048, 1184
master - mean (1,115ms) : 1045, 1185
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 (7790) - mean (278ms) : 273, 283
master - mean (276ms) : 272, 281
section Bailout
This PR (7790) - mean (278ms) : 274, 283
master - mean (277ms) : 274, 280
section CallTarget+Inlining+NGEN
This PR (7790) - mean (922ms) : 876, 968
master - mean (903ms) : 851, 955
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7790) - mean (272ms) : 265, 278
master - mean (270ms) : 264, 276
section Bailout
This PR (7790) - mean (272ms) : 267, 277
master - mean (268ms) : 265, 272
section CallTarget+Inlining+NGEN
This PR (7790) - mean (893ms) : 839, 947
master - mean (893ms) : 833, 953
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7790) - mean (270ms) : 266, 275
master - mean (270ms) : 265, 274
section Bailout
This PR (7790) - mean (271ms) : 267, 275
master - mean (269ms) : 266, 273
section CallTarget+Inlining+NGEN
This PR (7790) - mean (828ms) : 802, 853
master - mean (835ms) : 808, 862
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @@ -0,0 +1,109 @@ | |||
| # Benchmark Guidelines | |||
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.
Guide generated with Claude code.
|
Thanks for working on this, @NachoEchevarria! Seeing errors like these on the CI: The benchmarks completes successfully, though. Because of a rate limiting issue, the script failed to run the PR commenter1 and failed to upload results to the BP UI (which was done after the PR comment). I'm rue-running the benchmarks so we can get results on the BP UI and I can run the That said, looks good to me, excited to see the results. Footnotes
|
BenchmarksBenchmarks Report for benchmark platform 🐌Benchmarks for #7790 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 ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Asm.AppSecWafBenchmark - Slower
|
| Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑net472 | 1.192 | 310,066.46 | 369,700.00 | |
| Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑net472 | 1.158 | 429,711.67 | 497,500.00 |
| Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑netcoreapp3.1 | 2.096 | 720,470.98 | 343,750.00 | |
| Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑netcoreapp3.1 | 1.842 | 853,429.64 | 463,400.00 |
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑net6.0 | 2.24 KB | 2.83 KB | 590 B | 26.32% |
| Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑net6.0 | 4.55 KB | 5.14 KB | 591 B | 12.98% |
| Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑netcoreapp3.1 | 2.22 KB | 2.32 KB | 104 B | 4.69% |
| Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑netcoreapp3.1 | 4.48 KB | 4.58 KB | 104 B | 2.32% |
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑net472 | 4.66 KB | 0 b | -4.66 KB | -100.00% |
| Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑net472 | 2.29 KB | 0 b | -2.29 KB | -100.00% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | RunWafRealisticBenchmark |
net6.0 | 396μs | 119ns | 460ns | 0 | 0 | 0 | 4.55 KB |
| master | RunWafRealisticBenchmark |
netcoreapp3.1 | 809μs | 13.4μs | 134μs | 0 | 0 | 0 | 4.48 KB |
| master | RunWafRealisticBenchmark |
net472 | 430μs | 84.7ns | 328ns | 0 | 0 | 0 | 4.66 KB |
| master | RunWafRealisticBenchmarkWithAttack |
net6.0 | 289μs | 22.3ns | 83.3ns | 0 | 0 | 0 | 2.24 KB |
| master | RunWafRealisticBenchmarkWithAttack |
netcoreapp3.1 | 671μs | 13.5μs | 134μs | 0 | 0 | 0 | 2.22 KB |
| master | RunWafRealisticBenchmarkWithAttack |
net472 | 310μs | 37.6ns | 146ns | 0 | 0 | 0 | 2.29 KB |
| #7790 | RunWafRealisticBenchmark |
net6.0 | 432μs | 1.39μs | 5.02μs | 0 | 0 | 0 | 5.14 KB |
| #7790 | RunWafRealisticBenchmark |
netcoreapp3.1 | 472μs | 2.94μs | 28μs | 0 | 0 | 0 | 4.58 KB |
| #7790 | RunWafRealisticBenchmark |
net472 | 498μs | 279ns | 1.01μs | 0 | 0 | 0 | 0 b |
| #7790 | RunWafRealisticBenchmarkWithAttack |
net6.0 | 319μs | 1.09μs | 4.07μs | 0 | 0 | 0 | 2.83 KB |
| #7790 | RunWafRealisticBenchmarkWithAttack |
netcoreapp3.1 | 352μs | 2.48μs | 23.8μs | 0 | 0 | 0 | 2.32 KB |
| #7790 | RunWafRealisticBenchmarkWithAttack |
net472 | 370μs | 327ns | 1.18μs | 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 | 61.3μs | 41.5ns | 161ns | 0 | 0 | 0 | 14.52 KB |
| master | SendRequest |
netcoreapp3.1 | 71.6μs | 63.2ns | 245ns | 0 | 0 | 0 | 17.42 KB |
| master | SendRequest |
net472 | 0.00307ns | 0.00157ns | 0.00609ns | 0 | 0 | 0 | 0 b |
| #7790 | SendRequest |
net6.0 | 61.4μs | 30.4ns | 118ns | 0 | 0 | 0 | 14.52 KB |
| #7790 | SendRequest |
netcoreapp3.1 | 71.6μs | 75.2ns | 271ns | 0 | 0 | 0 | 17.42 KB |
| #7790 | SendRequest |
net472 | 0.165ns | 0.00293ns | 0.0114ns | 0 | 0 | 0 | 0 b |
Benchmarks.Trace.CharSliceBenchmark - Slower ⚠️ More allocations ⚠️
Slower ⚠️ in #7790
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑netcoreapp3.1
2.133
873,436.16
1,862,700.00
Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice‑netcoreapp3.1
1.856
2,146,682.03
3,984,300.00
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑netcoreapp3.1
1.645
1,693,476.25
2,786,000.00
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0
1.236
816,465.82
1,009,200.00
More allocations ⚠️ in #7790
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0
2 B
640 B
638 B
31,900.00%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑netcoreapp3.1
1 B
104 B
103 B
10,300.00%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑netcoreapp3.1
1 B
104 B
103 B
10,300.00%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net6.0
7 B
640 B
633 B
9,042.86%
Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice‑net472
641.95 KB
647.17 KB
5.21 KB
0.81%
| Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑netcoreapp3.1 | 2.133 | 873,436.16 | 1,862,700.00 | |
| Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice‑netcoreapp3.1 | 1.856 | 2,146,682.03 | 3,984,300.00 | |
| Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑netcoreapp3.1 | 1.645 | 1,693,476.25 | 2,786,000.00 | |
| Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0 | 1.236 | 816,465.82 | 1,009,200.00 |
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0 | 2 B | 640 B | 638 B | 31,900.00% |
| Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑netcoreapp3.1 | 1 B | 104 B | 103 B | 10,300.00% |
| Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑netcoreapp3.1 | 1 B | 104 B | 103 B | 10,300.00% |
| Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net6.0 | 7 B | 640 B | 633 B | 9,042.86% |
| Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice‑net472 | 641.95 KB | 647.17 KB | 5.21 KB | 0.81% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | OriginalCharSlice |
net6.0 | 1.91ms | 532ns | 1.99μs | 0 | 0 | 0 | 640.01 KB |
| master | OriginalCharSlice |
netcoreapp3.1 | 2.14ms | 7.49μs | 29μs | 0 | 0 | 0 | 640 KB |
| master | OriginalCharSlice |
net472 | 2.62ms | 881ns | 3.41μs | 100 | 0 | 0 | 641.95 KB |
| master | OptimizedCharSlice |
net6.0 | 1.35ms | 2.73μs | 10.6μs | 0 | 0 | 0 | 7 B |
| master | OptimizedCharSlice |
netcoreapp3.1 | 1.69ms | 297ns | 1.15μs | 0 | 0 | 0 | 1 B |
| master | OptimizedCharSlice |
net472 | 1.94ms | 170ns | 638ns | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSliceWithPool |
net6.0 | 816μs | 26.3ns | 102ns | 0 | 0 | 0 | 2 B |
| master | OptimizedCharSliceWithPool |
netcoreapp3.1 | 873μs | 52.2ns | 195ns | 0 | 0 | 0 | 1 B |
| master | OptimizedCharSliceWithPool |
net472 | 1.14ms | 113ns | 439ns | 0 | 0 | 0 | 0 b |
| #7790 | OriginalCharSlice |
net6.0 | 1.91ms | 3.6μs | 14μs | 0 | 0 | 0 | 640.64 KB |
| #7790 | OriginalCharSlice |
netcoreapp3.1 | 3.98ms | 1.28μs | 4.42μs | 0 | 0 | 0 | 640.1 KB |
| #7790 | OriginalCharSlice |
net472 | 2.63ms | 951ns | 3.68μs | 0 | 0 | 0 | 647.17 KB |
| #7790 | OptimizedCharSlice |
net6.0 | 1.43ms | 1.67μs | 6.01μs | 0 | 0 | 0 | 640 B |
| #7790 | OptimizedCharSlice |
netcoreapp3.1 | 2.79ms | 1.45μs | 5.62μs | 0 | 0 | 0 | 104 B |
| #7790 | OptimizedCharSlice |
net472 | 1.9ms | 521ns | 2.02μs | 0 | 0 | 0 | 0 b |
| #7790 | OptimizedCharSliceWithPool |
net6.0 | 1.01ms | 800ns | 2.88μs | 0 | 0 | 0 | 640 B |
| #7790 | OptimizedCharSliceWithPool |
netcoreapp3.1 | 1.86ms | 1.72μs | 6.67μs | 0 | 0 | 0 | 104 B |
| #7790 | OptimizedCharSliceWithPool |
net472 | 1.14ms | 806ns | 3.12μs | 0 | 0 | 0 | 0 b |
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Faster 🎉 More allocations ⚠️
Faster 🎉 in #7790
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net472
1.143
1,028,238.54
899,690.21
More allocations ⚠️ in #7790
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net472
55.94 KB
56.36 KB
420 B
0.75%
Fewer allocations 🎉 in #7790
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1
42.75 KB
41.87 KB
-878 B
-2.05%
| Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 | 1.143 | 1,028,238.54 | 899,690.21 |
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 | 55.94 KB | 56.36 KB | 420 B | 0.75% |
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 | 42.75 KB | 41.87 KB | -878 B | -2.05% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | WriteAndFlushEnrichedTraces |
net6.0 | 719μs | 937ns | 3.51μs | 0 | 0 | 0 | 41.78 KB |
| master | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 748μs | 2.2μs | 8.54μs | 0 | 0 | 0 | 42.75 KB |
| master | WriteAndFlushEnrichedTraces |
net472 | 1.03ms | 5.08μs | 21.6μs | 5.21 | 0 | 0 | 55.94 KB |
| #7790 | WriteAndFlushEnrichedTraces |
net6.0 | 699μs | 955ns | 3.7μs | 0 | 0 | 0 | 41.6 KB |
| #7790 | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 729μs | 3.9μs | 21μs | 0 | 0 | 0 | 41.87 KB |
| #7790 | WriteAndFlushEnrichedTraces |
net472 | 906μs | 3.41μs | 12.7μs | 8.33 | 0 | 0 | 56.36 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.89μs | 9.71ns | 47.6ns | 0 | 0 | 0 | 1.02 KB |
| master | ExecuteNonQuery |
netcoreapp3.1 | 2.62μs | 9.75ns | 37.8ns | 0 | 0 | 0 | 1.02 KB |
| master | ExecuteNonQuery |
net472 | 2.86μs | 3.4ns | 13.2ns | 0.156 | 0.0142 | 0 | 987 B |
| #7790 | ExecuteNonQuery |
net6.0 | 1.91μs | 7.86ns | 30.4ns | 0 | 0 | 0 | 1.02 KB |
| #7790 | ExecuteNonQuery |
netcoreapp3.1 | 2.71μs | 8.25ns | 28.6ns | 0 | 0 | 0 | 1.02 KB |
| #7790 | ExecuteNonQuery |
net472 | 2.73μs | 2.04ns | 7.89ns | 0.15 | 0 | 0 | 987 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.7μs | 7.41ns | 27.7ns | 0 | 0 | 0 | 1.03 KB |
| master | CallElasticsearch |
netcoreapp3.1 | 2.23μs | 7.38ns | 26.6ns | 0 | 0 | 0 | 1.03 KB |
| master | CallElasticsearch |
net472 | 3.56μs | 3.18ns | 12.3ns | 0.161 | 0 | 0 | 1.04 KB |
| master | CallElasticsearchAsync |
net6.0 | 1.8μs | 1.26ns | 4.56ns | 0 | 0 | 0 | 1.01 KB |
| master | CallElasticsearchAsync |
netcoreapp3.1 | 2.32μs | 11.2ns | 46.2ns | 0 | 0 | 0 | 1.08 KB |
| master | CallElasticsearchAsync |
net472 | 3.84μs | 4.65ns | 18ns | 0.173 | 0 | 0 | 1.1 KB |
| #7790 | CallElasticsearch |
net6.0 | 1.72μs | 8.83ns | 43.3ns | 0 | 0 | 0 | 1.03 KB |
| #7790 | CallElasticsearch |
netcoreapp3.1 | 2.24μs | 9.93ns | 37.1ns | 0 | 0 | 0 | 1.03 KB |
| #7790 | CallElasticsearch |
net472 | 3.57μs | 1.82ns | 7.05ns | 0.161 | 0 | 0 | 1.04 KB |
| #7790 | CallElasticsearchAsync |
net6.0 | 1.84μs | 6.89ns | 26.7ns | 0 | 0 | 0 | 1.01 KB |
| #7790 | CallElasticsearchAsync |
netcoreapp3.1 | 2.45μs | 5.24ns | 20.3ns | 0 | 0 | 0 | 1.08 KB |
| #7790 | CallElasticsearchAsync |
net472 | 3.86μs | 4.04ns | 15.7ns | 0.174 | 0 | 0 | 1.1 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 | 5.4ns | 20.9ns | 0 | 0 | 0 | 952 B |
| master | ExecuteAsync |
netcoreapp3.1 | 2.5μs | 3.77ns | 14.6ns | 0 | 0 | 0 | 952 B |
| master | ExecuteAsync |
net472 | 2.52μs | 0.907ns | 3.51ns | 0.138 | 0 | 0 | 915 B |
| #7790 | ExecuteAsync |
net6.0 | 1.9μs | 9.72ns | 45.6ns | 0 | 0 | 0 | 952 B |
| #7790 | ExecuteAsync |
netcoreapp3.1 | 2.37μs | 9.96ns | 38.6ns | 0 | 0 | 0 | 952 B |
| #7790 | ExecuteAsync |
net472 | 2.65μs | 2.37ns | 9.2ns | 0.132 | 0 | 0 | 915 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μs | 4.77ns | 17.8ns | 0 | 0 | 0 | 2.36 KB |
| master | SendAsync |
netcoreapp3.1 | 9.15μs | 26.8ns | 104ns | 0 | 0 | 0 | 2.9 KB |
| master | SendAsync |
net472 | 12μs | 6.39ns | 23.9ns | 0.481 | 0 | 0 | 3.18 KB |
| #7790 | SendAsync |
net6.0 | 6.69μs | 6.13ns | 23.7ns | 0 | 0 | 0 | 2.36 KB |
| #7790 | SendAsync |
netcoreapp3.1 | 8.48μs | 34.9ns | 135ns | 0 | 0 | 0 | 2.9 KB |
| #7790 | SendAsync |
net472 | 12.4μs | 10.9ns | 42.1ns | 0.494 | 0 | 0 | 3.18 KB |
Benchmarks.Trace.Iast.StringAspectsBenchmark - Slower ⚠️ More allocations ⚠️
Slower ⚠️ in #7790
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0
1.152
458,750.00
528,300.00
More allocations ⚠️ in #7790
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0
258.88 KB
277.25 KB
18.37 KB
7.10%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1
258.66 KB
273.63 KB
14.98 KB
5.79%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0
43.44 KB
43.86 KB
416 B
0.96%
Fewer allocations 🎉 in #7790
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1
43.19 KB
42.87 KB
-320 B
-0.74%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472
65.54 KB
57.34 KB
-8.19 KB
-12.50%
| Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 | 1.152 | 458,750.00 | 528,300.00 |
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 | 258.88 KB | 277.25 KB | 18.37 KB | 7.10% |
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 | 258.66 KB | 273.63 KB | 14.98 KB | 5.79% |
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 | 43.44 KB | 43.86 KB | 416 B | 0.96% |
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1 | 43.19 KB | 42.87 KB | -320 B | -0.74% |
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 | 65.54 KB | 57.34 KB | -8.19 KB | -12.50% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StringConcatBenchmark |
net6.0 | 45.5μs | 252ns | 2.09μs | 0 | 0 | 0 | 43.44 KB |
| master | StringConcatBenchmark |
netcoreapp3.1 | 50μs | 290ns | 2.28μs | 0 | 0 | 0 | 43.19 KB |
| master | StringConcatBenchmark |
net472 | 58.2μs | 169ns | 632ns | 0 | 0 | 0 | 65.54 KB |
| master | StringConcatAspectBenchmark |
net6.0 | 459μs | 1.55μs | 6.22μs | 0 | 0 | 0 | 258.88 KB |
| master | StringConcatAspectBenchmark |
netcoreapp3.1 | 523μs | 2.54μs | 10.8μs | 0 | 0 | 0 | 258.66 KB |
| master | StringConcatAspectBenchmark |
net472 | 411μs | 2.07μs | 10.5μs | 0 | 0 | 0 | 278.53 KB |
| #7790 | StringConcatBenchmark |
net6.0 | 41.3μs | 144ns | 520ns | 0 | 0 | 0 | 43.86 KB |
| #7790 | StringConcatBenchmark |
netcoreapp3.1 | 50.8μs | 437ns | 4.1μs | 0 | 0 | 0 | 42.87 KB |
| #7790 | StringConcatBenchmark |
net472 | 57.6μs | 279ns | 1.18μs | 0 | 0 | 0 | 57.34 KB |
| #7790 | StringConcatAspectBenchmark |
net6.0 | 531μs | 1.9μs | 6.84μs | 0 | 0 | 0 | 277.25 KB |
| #7790 | StringConcatAspectBenchmark |
netcoreapp3.1 | 497μs | 1.06μs | 3.82μs | 0 | 0 | 0 | 273.63 KB |
| #7790 | StringConcatAspectBenchmark |
net472 | 404μs | 2.22μs | 17.2μs | 0 | 0 | 0 | 278.53 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.67μs | 13.7ns | 61.1ns | 0 | 0 | 0 | 1.7 KB |
| master | EnrichedLog |
netcoreapp3.1 | 3.58μs | 9.86ns | 38.2ns | 0 | 0 | 0 | 1.7 KB |
| master | EnrichedLog |
net472 | 3.97μs | 3.72ns | 14.4ns | 0.257 | 0 | 0 | 1.64 KB |
| #7790 | EnrichedLog |
net6.0 | 2.66μs | 10.7ns | 38.7ns | 0 | 0 | 0 | 1.7 KB |
| #7790 | EnrichedLog |
netcoreapp3.1 | 3.58μs | 18.3ns | 82ns | 0 | 0 | 0 | 1.7 KB |
| #7790 | EnrichedLog |
net472 | 3.97μs | 4.06ns | 15.7ns | 0.259 | 0 | 0 | 1.64 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 | 122μs | 72.1ns | 260ns | 0 | 0 | 0 | 4.31 KB |
| master | EnrichedLog |
netcoreapp3.1 | 128μs | 72.6ns | 262ns | 0 | 0 | 0 | 4.31 KB |
| master | EnrichedLog |
net472 | 166μs | 232ns | 897ns | 0 | 0 | 0 | 4.52 KB |
| #7790 | EnrichedLog |
net6.0 | 124μs | 97.1ns | 376ns | 0 | 0 | 0 | 4.31 KB |
| #7790 | EnrichedLog |
netcoreapp3.1 | 130μs | 274ns | 987ns | 0 | 0 | 0 | 4.31 KB |
| #7790 | EnrichedLog |
net472 | 166μs | 114ns | 427ns | 0 | 0 | 0 | 4.52 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μs | 23.5ns | 97ns | 0 | 0 | 0 | 2.26 KB |
| master | EnrichedLog |
netcoreapp3.1 | 6.9μs | 28.4ns | 110ns | 0 | 0 | 0 | 2.26 KB |
| master | EnrichedLog |
net472 | 7.58μs | 4.68ns | 17.5ns | 0.301 | 0 | 0 | 2.08 KB |
| #7790 | EnrichedLog |
net6.0 | 4.93μs | 17.1ns | 66.1ns | 0 | 0 | 0 | 2.26 KB |
| #7790 | EnrichedLog |
netcoreapp3.1 | 6.9μs | 31.8ns | 123ns | 0 | 0 | 0 | 2.26 KB |
| #7790 | EnrichedLog |
net472 | 7.49μs | 5.47ns | 21.2ns | 0.299 | 0 | 0 | 2.08 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 | 2.01μs | 1.23ns | 4.61ns | 0 | 0 | 0 | 1.2 KB |
| master | SendReceive |
netcoreapp3.1 | 2.52μs | 12ns | 48.2ns | 0 | 0 | 0 | 1.2 KB |
| master | SendReceive |
net472 | 3.19μs | 5.06ns | 19.6ns | 0.189 | 0 | 0 | 1.2 KB |
| #7790 | SendReceive |
net6.0 | 2μs | 2.73ns | 10.6ns | 0 | 0 | 0 | 1.2 KB |
| #7790 | SendReceive |
netcoreapp3.1 | 2.6μs | 3.75ns | 14.5ns | 0 | 0 | 0 | 1.2 KB |
| #7790 | SendReceive |
net472 | 3.03μs | 4.29ns | 15.5ns | 0.18 | 0 | 0 | 1.2 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.31μs | 13.3ns | 49.9ns | 0 | 0 | 0 | 1.58 KB |
| master | EnrichedLog |
netcoreapp3.1 | 5.59μs | 5.7ns | 22.1ns | 0 | 0 | 0 | 1.63 KB |
| master | EnrichedLog |
net472 | 6.92μs | 6.43ns | 24.1ns | 0.311 | 0 | 0 | 2.03 KB |
| #7790 | EnrichedLog |
net6.0 | 4.39μs | 2.35ns | 9.11ns | 0 | 0 | 0 | 1.58 KB |
| #7790 | EnrichedLog |
netcoreapp3.1 | 5.71μs | 12.8ns | 49.7ns | 0 | 0 | 0 | 1.63 KB |
| #7790 | EnrichedLog |
net472 | 6.85μs | 6.24ns | 23.4ns | 0.308 | 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 | 788ns | 4.15ns | 20.3ns | 0 | 0 | 0 | 576 B |
| master | StartFinishSpan |
netcoreapp3.1 | 973ns | 4.79ns | 19.7ns | 0 | 0 | 0 | 576 B |
| master | StartFinishSpan |
net472 | 942ns | 0.772ns | 2.99ns | 0.09 | 0 | 0 | 578 B |
| master | StartFinishScope |
net6.0 | 930ns | 4.96ns | 24.8ns | 0 | 0 | 0 | 696 B |
| master | StartFinishScope |
netcoreapp3.1 | 1.17μs | 6.38ns | 36.1ns | 0 | 0 | 0 | 696 B |
| master | StartFinishScope |
net472 | 1.18μs | 0.919ns | 3.44ns | 0.1 | 0 | 0 | 658 B |
| #7790 | StartFinishSpan |
net6.0 | 780ns | 0.126ns | 0.472ns | 0 | 0 | 0 | 576 B |
| #7790 | StartFinishSpan |
netcoreapp3.1 | 982ns | 4.64ns | 18.6ns | 0 | 0 | 0 | 576 B |
| #7790 | StartFinishSpan |
net472 | 912ns | 1.22ns | 4.71ns | 0.0874 | 0 | 0 | 578 B |
| #7790 | StartFinishScope |
net6.0 | 950ns | 4.61ns | 18.5ns | 0 | 0 | 0 | 696 B |
| #7790 | StartFinishScope |
netcoreapp3.1 | 1.2μs | 6.26ns | 30ns | 0 | 0 | 0 | 696 B |
| #7790 | StartFinishScope |
net472 | 1.1μs | 0.234ns | 0.906ns | 0.104 | 0 | 0 | 658 B |
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.08μs | 5.6ns | 22.4ns | 0 | 0 | 0 | 696 B |
| master | RunOnMethodBegin |
netcoreapp3.1 | 1.49μs | 5.97ns | 23.1ns | 0 | 0 | 0 | 696 B |
| master | RunOnMethodBegin |
net472 | 1.45μs | 0.655ns | 2.45ns | 0.102 | 0 | 0 | 658 B |
| #7790 | RunOnMethodBegin |
net6.0 | 1.06μs | 0.598ns | 2.32ns | 0 | 0 | 0 | 696 B |
| #7790 | RunOnMethodBegin |
netcoreapp3.1 | 1.41μs | 5.16ns | 20ns | 0 | 0 | 0 | 696 B |
| #7790 | RunOnMethodBegin |
net472 | 1.45μs | 1.06ns | 4.11ns | 0.101 | 0 | 0 | 658 B |
Thanks! I will check the cause of the errors. |
|
I ran the flakiness check again for 0f5d7f6, looks like there were some big improvements! E.g., Full check: https://gist.github.com/igoragoli/806c821ba255e1a8fcad6538307ae323 |
This comment has been minimized.
This comment has been minimized.
|
I simplified the Full check comparing this branch at 82bfad against master at 8603e6d: https://docs.google.com/spreadsheets/d/1LKKYSYefti9l4AVA1imZSssPes0aDuqkSUD7zfxlONw/edit?usp=sharing |
igoragoli
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.
Tests are a bit inconclusive (there's still a bit flakiness and many benchmarks on this branch weren't run), but approving since changes look good to me!
andrewlock
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.
Thanks! I have some questions about the remaining statics though - I can't see how we justify keeping them when ditching all the others? 😄
tracer/test/benchmarks/Benchmarks.Trace/Asm/AppSecEncodeBenchmark.cs
Outdated
Show resolved
Hide resolved
tracer/test/benchmarks/Benchmarks.Trace/Asm/AppSecWafBenchmark.cs
Outdated
Show resolved
Hide resolved
daniel-romano-DD
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.
Thanks a lot
Summary of changes
This PR addresses benchmark flakiness detected by eliminating static constructors and moving all initialization to
[GlobalSetup]methods, which BenchmarkDotNet explicitly excludes from timing measurements.Benchmarks were experiencing flakiness due to:
staticfields with[GlobalSetup]creates confusion since GlobalSetup runs once per benchmark method, not once per classWhy Use Instance Fields for Runtime State?
[GlobalSetup]runs once per benchmark method, not once per class. Using instance fields for runtime state (clients, services, etc.):Why Use
static readonlyfor Test Data?For pre-computed immutable test data (lambdas, test objects, constant values):
static readonlyfields can be inlined and optimized better than instance fieldsReason for change
Benchmark variance analysis revealed high Coefficients of Variation (CV) ranging from 5.8% to 151%, indicating unstable and unreliable performance measurements.
Implementation details
Test coverage
Other details