Skip to content

Commit 1c4b34f

Browse files
committed
Move more code out of the benchmarked code
1 parent 433bc51 commit 1c4b34f

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

Source/Tests/Plugins/DeduplicationBenchmarks.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,27 @@
1010
namespace Exceptionless.Tests.Plugins {
1111
public class DeduplicationBenchmarks {
1212
private readonly List<Event> _events;
13+
private readonly ExceptionlessClient _client;
14+
private readonly ErrorPlugin _errorPlugin;
15+
private readonly DuplicateCheckerPlugin _duplicateCheckerPlugin;
16+
1317
public DeduplicationBenchmarks() {
1418
_events = ErrorDataReader.GetEvents().ToList();
19+
_client = new ExceptionlessClient();
20+
_errorPlugin = new ErrorPlugin();
21+
_duplicateCheckerPlugin = new DuplicateCheckerPlugin();
1522
}
1623

1724
[Benchmark]
1825
public void TestBenchmark1() {
19-
var client = new ExceptionlessClient();
20-
var errorPlugin = new ErrorPlugin();
21-
var duplicateCheckerPlugin = new DuplicateCheckerPlugin();
22-
2326
foreach (var ev in _events) {
2427
var pluginContextData = new ContextData();
2528

2629
for (int index = 0; index < 2; index++) {
27-
var context = new EventPluginContext(client, ev, pluginContextData);
30+
var context = new EventPluginContext(_client, ev, pluginContextData);
2831

29-
errorPlugin.Run(context);
30-
duplicateCheckerPlugin.Run(context);
32+
_errorPlugin.Run(context);
33+
_duplicateCheckerPlugin.Run(context);
3134
}
3235
}
3336
}

0 commit comments

Comments
 (0)