-
-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathSourceBenchmarks.cs
More file actions
34 lines (27 loc) · 673 Bytes
/
SourceBenchmarks.cs
File metadata and controls
34 lines (27 loc) · 673 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
namespace Towel_Benchmarking;
[Tag(Program.Name, "Source")]
[Tag(Program.OutputFile, nameof(SourceOfBenchmarks))]
public class SourceOfBenchmarks
{
internal bool a;
internal bool b;
internal Exception exception;
public SourceOfBenchmarks()
{
a = false;
b = true;
exception = new();
}
[Benchmark]
public void Control()
{
if (a) exception = new ArgumentException("a", "a");
if (b) exception = new ArgumentException("b", "b");
}
[Benchmark]
public void SourceOf()
{
if (sourceof(a, out string check1)) exception = new ArgumentException(check1, "a");
if (sourceof(b, out string check2)) exception = new ArgumentException(check2, "b");
}
}