-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
34 lines (29 loc) · 811 Bytes
/
Program.cs
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
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System;
namespace Test
{
class Program
{
public static void Main(string[] args)
{
var summary = BenchmarkRunner.Run<MyBenchmark>();
Console.ReadKey();
}
}
public class MyBenchmark
{
public static bool IsNullOrEmpty(string value) => (value == null || 0u >= (uint)value.Length);
public static bool IsNullOrEmpty2(string value) => (value == null || 0u >= (uint)value.Length) ? true : false;
[Benchmark]
public bool IsNullOrEmpty()
{
return IsNullOrEmpty("test string");
}
[Benchmark]
public bool IsNullOrEmpty2()
{
return IsNullOrEmpty2("test string");
}
}
}