Skip to content

Commit 7f64d50

Browse files
Moved code from GlobalSetup so that this doesn't escape measurement
1 parent 552e89b commit 7f64d50

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

benchmarks/Sentry.Benchmarks/BenchmarkDotNet.Artifacts/results/MvvmBenchmarks-report-github.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Apple M2 Max, 1 CPU, 12 logical and 12 physical cores
88
99
1010
```
11-
| Method | ResolveOptionsWithServiceProvider | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
12-
|----------------- |---------------------------------- |---------:|--------:|---------:|--------:|-------:|----------:|
13-
| **'Build MAUI App'** | **Directly** | **470.8 μs** | **9.02 μs** | **9.65 μs** | **11.7188** | **2.9297** | **99.25 KB** |
14-
| **'Build MAUI App'** | **ServiceProvider** | **473.6 μs** | **8.73 μs** | **13.85 μs** | **11.7188** | **2.9297** | **98.66 KB** |
15-
| **'Build MAUI App'** | **InvokeConfigOptions** | **462.0 μs** | **8.84 μs** | **10.18 μs** | **11.7188** | **2.9297** | **98.74 KB** |
11+
| Method | ResolveOptionsWithServiceProvider | Mean | Error | StdDev | Median | Gen0 | Gen1 | Allocated |
12+
|----------------- |---------------------------------- |---------:|---------:|---------:|---------:|--------:|-------:|----------:|
13+
| **'Build MAUI App'** | **Directly** | **494.3 μs** | **19.62 μs** | **53.38 μs** | **476.0 μs** | **12.6953** | **2.9297** | **105.13 KB** |
14+
| **'Build MAUI App'** | **ServiceProvider** | **488.1 μs** | **8.56 μs** | **12.55 μs** | **486.6 μs** | **15.6250** | **3.9063** | **129.52 KB** |
15+
| **'Build MAUI App'** | **InvokeConfigOptions** | **499.5 μs** | **9.93 μs** | **22.21 μs** | **501.9 μs** | **12.6953** | **3.9063** | **110.23 KB** |

benchmarks/Sentry.Benchmarks/MvvmBenchmarks.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44

55
public class MvvmBenchmarks
66
{
7-
private MauiAppBuilder AppBuilder;
8-
97
[Params(RegisterEventBinderMethod.ServiceProvider, RegisterEventBinderMethod.InvokeConfigOptions, RegisterEventBinderMethod.Directly)]
108
public RegisterEventBinderMethod ResolveOptionsWithServiceProvider;
119

12-
[GlobalSetup]
13-
public void Setup()
10+
[Benchmark(Description = "Build MAUI App")]
11+
public void BuildMauiAppBenchmark()
1412
{
15-
AppBuilder = MauiApp.CreateBuilder()
13+
var appBuilder = MauiApp.CreateBuilder()
1614
// This adds Sentry to your Maui application
1715
.UseSentry(options =>
1816
{
@@ -21,11 +19,6 @@ public void Setup()
2119
// Automatically create traces for async relay commands in the MVVM Community Toolkit
2220
options.AddCommunityToolkitIntegration();
2321
}, ResolveOptionsWithServiceProvider);
24-
}
25-
26-
[Benchmark(Description = "Build MAUI App")]
27-
public void BuildMauiAppBenchmark()
28-
{
29-
AppBuilder.Build();
22+
appBuilder.Build();
3023
}
3124
}

0 commit comments

Comments
 (0)