-
Notifications
You must be signed in to change notification settings - Fork 124
Expand file tree
/
Copy pathAsyncPerf.cs
More file actions
43 lines (37 loc) · 892 Bytes
/
AsyncPerf.cs
File metadata and controls
43 lines (37 loc) · 892 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
35
36
37
38
39
40
41
42
43
using System;
using System.Threading.Tasks;
using BenchmarkComponent;
using BenchmarkDotNet.Attributes;
namespace Benchmarks
{
[MemoryDiagnoser]
public class AsyncPerf
{
ClassWithAsync instance;
[GlobalSetup]
public void Setup()
{
instance = new ClassWithAsync();
}
[Benchmark]
public async Task Complete()
{
await instance.Complete();
}
[Benchmark]
public async Task YieldComplete()
{
await instance.YieldComplete();
}
[Benchmark]
public async Task<int> Return()
{
return await instance.Return(5);
}
[Benchmark]
public async Task<int> YieldReturn()
{
return await instance.YieldReturn(5);
}
}
}