-
Notifications
You must be signed in to change notification settings - Fork 147
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
[Test Optimization] - Code refactor #6709
Conversation
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing the following branches/commits: Execution-time benchmarks measure the whole time it takes to execute a program. And are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are shown in red. The following thresholds were used for comparing the execution times:
Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard. Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph). gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6709) - mean (75ms) : 70, 80
. : milestone, 75,
master - mean (70ms) : 66, 73
. : milestone, 70,
section CallTarget+Inlining+NGEN
This PR (6709) - mean (1,041ms) : 1011, 1071
. : milestone, 1041,
master - mean (1,006ms) : 978, 1033
. : milestone, 1006,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6709) - mean (110ms) : 105, 114
. : milestone, 110,
master - mean (102ms) : 100, 105
. : milestone, 102,
section CallTarget+Inlining+NGEN
This PR (6709) - mean (706ms) : 685, 727
. : milestone, 706,
master - mean (677ms) : 661, 692
. : milestone, 677,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6709) - mean (96ms) : 92, 100
. : milestone, 96,
master - mean (90ms) : 88, 91
. : milestone, 90,
section CallTarget+Inlining+NGEN
This PR (6709) - mean (664ms) : 644, 683
. : milestone, 664,
master - mean (637ms) : 618, 656
. : milestone, 637,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6709) - mean (192ms) : 187, 196
. : milestone, 192,
master - mean (190ms) : 186, 195
. : milestone, 190,
section CallTarget+Inlining+NGEN
This PR (6709) - mean (1,104ms) : 1082, 1126
. : milestone, 1104,
master - mean (1,109ms) : 1078, 1139
. : milestone, 1109,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6709) - mean (271ms) : 267, 276
. : milestone, 271,
master - mean (270ms) : 267, 274
. : milestone, 270,
section CallTarget+Inlining+NGEN
This PR (6709) - mean (863ms) : 841, 885
. : milestone, 863,
master - mean (880ms) : 814, 946
. : milestone, 880,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6709) - mean (263ms) : 258, 267
. : milestone, 263,
master - mean (262ms) : 257, 267
. : milestone, 262,
section CallTarget+Inlining+NGEN
This PR (6709) - mean (848ms) : 815, 881
. : milestone, 848,
master - mean (849ms) : 821, 878
. : milestone, 849,
|
Benchmarks Report for tracer 🐌Benchmarks for #6709 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.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ElasticsearchBenchmark - Faster 🎉 Same allocations ✔️
|
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑net6.0 | 1.184 | 1,410.15 | 1,190.66 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | CallElasticsearch |
net6.0 | 1.41μs | 0.567ns | 2.12ns | 0.0141 | 0 | 0 | 976 B |
master | CallElasticsearch |
netcoreapp3.1 | 1.56μs | 0.45ns | 1.68ns | 0.0133 | 0 | 0 | 976 B |
master | CallElasticsearch |
net472 | 2.59μs | 2.28ns | 8.53ns | 0.158 | 0 | 0 | 995 B |
master | CallElasticsearchAsync |
net6.0 | 1.38μs | 0.521ns | 1.95ns | 0.0132 | 0 | 0 | 952 B |
master | CallElasticsearchAsync |
netcoreapp3.1 | 1.63μs | 0.91ns | 3.53ns | 0.0131 | 0 | 0 | 1.02 KB |
master | CallElasticsearchAsync |
net472 | 2.63μs | 1.44ns | 5.59ns | 0.166 | 0 | 0 | 1.05 KB |
#6709 | CallElasticsearch |
net6.0 | 1.19μs | 0.941ns | 3.64ns | 0.0135 | 0 | 0 | 976 B |
#6709 | CallElasticsearch |
netcoreapp3.1 | 1.54μs | 0.548ns | 2.05ns | 0.013 | 0 | 0 | 976 B |
#6709 | CallElasticsearch |
net472 | 2.44μs | 3.01ns | 11.7ns | 0.158 | 0 | 0 | 995 B |
#6709 | CallElasticsearchAsync |
net6.0 | 1.35μs | 0.794ns | 2.97ns | 0.0128 | 0 | 0 | 952 B |
#6709 | CallElasticsearchAsync |
netcoreapp3.1 | 1.62μs | 1.43ns | 5.15ns | 0.0139 | 0 | 0 | 1.02 KB |
#6709 | CallElasticsearchAsync |
net472 | 2.62μs | 1.14ns | 4.41ns | 0.167 | 0 | 0 | 1.05 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.27μs | 0.549ns | 2.06ns | 0.0134 | 0 | 0 | 952 B |
master | ExecuteAsync |
netcoreapp3.1 | 1.69μs | 0.743ns | 2.88ns | 0.0128 | 0 | 0 | 952 B |
master | ExecuteAsync |
net472 | 1.87μs | 0.472ns | 1.77ns | 0.145 | 0 | 0 | 915 B |
#6709 | ExecuteAsync |
net6.0 | 1.24μs | 1.67ns | 6.48ns | 0.0136 | 0 | 0 | 952 B |
#6709 | ExecuteAsync |
netcoreapp3.1 | 1.58μs | 1.23ns | 4.76ns | 0.0129 | 0 | 0 | 952 B |
#6709 | ExecuteAsync |
net472 | 1.82μs | 0.54ns | 2.09ns | 0.145 | 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 | 4.42μs | 3.19ns | 12ns | 0.0331 | 0 | 0 | 2.31 KB |
master | SendAsync |
netcoreapp3.1 | 5.42μs | 2.36ns | 9.13ns | 0.0379 | 0 | 0 | 2.85 KB |
master | SendAsync |
net472 | 7.43μs | 1.57ns | 6.07ns | 0.493 | 0 | 0 | 3.12 KB |
#6709 | SendAsync |
net6.0 | 4.56μs | 1.91ns | 7.41ns | 0.032 | 0 | 0 | 2.31 KB |
#6709 | SendAsync |
netcoreapp3.1 | 5.34μs | 4.25ns | 15.3ns | 0.0373 | 0 | 0 | 2.85 KB |
#6709 | SendAsync |
net472 | 7.52μs | 1.56ns | 6.03ns | 0.496 | 0 | 0 | 3.12 KB |
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 1.51μs | 0.885ns | 3.31ns | 0.0227 | 0 | 0 | 1.64 KB |
master | EnrichedLog |
netcoreapp3.1 | 2.14μs | 3ns | 11.6ns | 0.0216 | 0 | 0 | 1.64 KB |
master | EnrichedLog |
net472 | 2.6μs | 1.16ns | 4.34ns | 0.25 | 0 | 0 | 1.57 KB |
#6709 | EnrichedLog |
net6.0 | 1.63μs | 0.94ns | 3.25ns | 0.0228 | 0 | 0 | 1.64 KB |
#6709 | EnrichedLog |
netcoreapp3.1 | 2.23μs | 4.52ns | 16.9ns | 0.022 | 0 | 0 | 1.64 KB |
#6709 | EnrichedLog |
net472 | 2.6μs | 1.33ns | 5.15ns | 0.25 | 0 | 0 | 1.57 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 | 112μs | 57.1ns | 214ns | 0.0559 | 0 | 0 | 4.28 KB |
master | EnrichedLog |
netcoreapp3.1 | 117μs | 213ns | 824ns | 0 | 0 | 0 | 4.28 KB |
master | EnrichedLog |
net472 | 151μs | 120ns | 466ns | 0.679 | 0.226 | 0 | 4.46 KB |
#6709 | EnrichedLog |
net6.0 | 113μs | 201ns | 777ns | 0.0561 | 0 | 0 | 4.28 KB |
#6709 | EnrichedLog |
netcoreapp3.1 | 117μs | 146ns | 565ns | 0.058 | 0 | 0 | 4.28 KB |
#6709 | EnrichedLog |
net472 | 150μs | 198ns | 766ns | 0.671 | 0.224 | 0 | 4.46 KB |
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 3.1μs | 0.965ns | 3.74ns | 0.031 | 0 | 0 | 2.2 KB |
master | EnrichedLog |
netcoreapp3.1 | 4.18μs | 4.19ns | 16.2ns | 0.029 | 0 | 0 | 2.2 KB |
master | EnrichedLog |
net472 | 4.81μs | 0.499ns | 1.87ns | 0.318 | 0 | 0 | 2.02 KB |
#6709 | EnrichedLog |
net6.0 | 3.22μs | 0.58ns | 2.17ns | 0.0305 | 0 | 0 | 2.2 KB |
#6709 | EnrichedLog |
netcoreapp3.1 | 4.2μs | 1.65ns | 5.94ns | 0.0294 | 0 | 0 | 2.2 KB |
#6709 | EnrichedLog |
net472 | 4.81μs | 1.63ns | 6.33ns | 0.319 | 0 | 0 | 2.02 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.32μs | 0.866ns | 3.36ns | 0.0159 | 0 | 0 | 1.14 KB |
master | SendReceive |
netcoreapp3.1 | 1.79μs | 1.19ns | 4.62ns | 0.0152 | 0 | 0 | 1.14 KB |
master | SendReceive |
net472 | 2.12μs | 0.528ns | 1.9ns | 0.183 | 0 | 0 | 1.16 KB |
#6709 | SendReceive |
net6.0 | 1.4μs | 0.827ns | 3.2ns | 0.0161 | 0 | 0 | 1.14 KB |
#6709 | SendReceive |
netcoreapp3.1 | 1.75μs | 1.36ns | 5.25ns | 0.0157 | 0 | 0 | 1.14 KB |
#6709 | SendReceive |
net472 | 2.14μs | 1.48ns | 5.73ns | 0.183 | 0 | 0 | 1.16 KB |
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 2.76μs | 1.16ns | 4.48ns | 0.0221 | 0 | 0 | 1.6 KB |
master | EnrichedLog |
netcoreapp3.1 | 3.84μs | 1.57ns | 6.07ns | 0.021 | 0 | 0 | 1.65 KB |
master | EnrichedLog |
net472 | 4.24μs | 2.57ns | 9.63ns | 0.322 | 0 | 0 | 2.04 KB |
#6709 | EnrichedLog |
net6.0 | 2.76μs | 0.624ns | 2.42ns | 0.022 | 0 | 0 | 1.6 KB |
#6709 | EnrichedLog |
netcoreapp3.1 | 3.88μs | 1.48ns | 5.73ns | 0.0212 | 0 | 0 | 1.65 KB |
#6709 | EnrichedLog |
net472 | 4.32μs | 2.53ns | 9.81ns | 0.322 | 0 | 0 | 2.04 KB |
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ Same allocations ✔️
Slower ⚠️ in #6709
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0
1.126
412.96
465.18
Faster 🎉 in #6709
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net472
1.119
844.90
755.18
Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 | 1.126 | 412.96 | 465.18 |
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net472 | 1.119 | 844.90 | 755.18 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StartFinishSpan |
net6.0 | 412ns | 0.714ns | 2.76ns | 0.00808 | 0 | 0 | 576 B |
master | StartFinishSpan |
netcoreapp3.1 | 564ns | 1.37ns | 5.31ns | 0.0076 | 0 | 0 | 576 B |
master | StartFinishSpan |
net472 | 563ns | 1.15ns | 4.45ns | 0.0917 | 0 | 0 | 578 B |
master | StartFinishScope |
net6.0 | 472ns | 1.04ns | 3.9ns | 0.00987 | 0 | 0 | 696 B |
master | StartFinishScope |
netcoreapp3.1 | 670ns | 0.765ns | 2.96ns | 0.00926 | 0 | 0 | 696 B |
master | StartFinishScope |
net472 | 845ns | 0.553ns | 2ns | 0.104 | 0 | 0 | 658 B |
#6709 | StartFinishSpan |
net6.0 | 465ns | 0.637ns | 2.47ns | 0.00803 | 0 | 0 | 576 B |
#6709 | StartFinishSpan |
netcoreapp3.1 | 544ns | 1.01ns | 3.92ns | 0.0078 | 0 | 0 | 576 B |
#6709 | StartFinishSpan |
net472 | 606ns | 0.371ns | 1.34ns | 0.0916 | 0 | 0 | 578 B |
#6709 | StartFinishScope |
net6.0 | 486ns | 0.85ns | 3.18ns | 0.00967 | 0 | 0 | 696 B |
#6709 | StartFinishScope |
netcoreapp3.1 | 708ns | 1.43ns | 5.54ns | 0.00929 | 0 | 0 | 696 B |
#6709 | StartFinishScope |
net472 | 754ns | 1.4ns | 5.44ns | 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 | 617ns | 0.913ns | 3.54ns | 0.00965 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
netcoreapp3.1 | 896ns | 1.7ns | 6.6ns | 0.00938 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
net472 | 1.07μs | 2ns | 7.74ns | 0.104 | 0 | 0 | 658 B |
#6709 | RunOnMethodBegin |
net6.0 | 656ns | 1.18ns | 4.56ns | 0.00989 | 0 | 0 | 696 B |
#6709 | RunOnMethodBegin |
netcoreapp3.1 | 914ns | 1.59ns | 6.15ns | 0.00932 | 0 | 0 | 696 B |
#6709 | RunOnMethodBegin |
net472 | 1.03μs | 2.17ns | 8.39ns | 0.104 | 0 | 0 | 658 B |
Summary of changes
https://datadoghq.atlassian.net/browse/SDTEST-1423
This PR introduces a complete refactor of the existing two classes:
Alsos rename the following classes:
With the refactor the following changes were made:
CIVisibility.cs
IntelligentTestRunnerClient.cs
Reason for change
The current code is already complex and hard to maintain, all features are included in only two classes. Before introducing more features in the product (KnownTests, FlakyTestManagement) we need to improve the existing code and make our life easier.
Implementation details
It's the same code sparse in different files with a better structure for both adding new features and testing.
Test coverage
Same tests must behave the same we are not looking for a change of the current behavior.
Other details