-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathColorHashSharpBenchmarks.cs
More file actions
44 lines (38 loc) · 1.06 KB
/
ColorHashSharpBenchmarks.cs
File metadata and controls
44 lines (38 loc) · 1.06 KB
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
44
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using Fernandezja.ColorHashSharp;
using Fernandezja.ColorHashSharp.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ColorHashSharp.Benchmarks
{
[MemoryDiagnoser]
[SimpleJob(RuntimeMoniker.Net48)]
[SimpleJob(RuntimeMoniker.Net481)]
[SimpleJob(RuntimeMoniker.Net80, baseline: true)]
[SimpleJob(RuntimeMoniker.Net90)]
[SimpleJob(RuntimeMoniker.Net10_0)]
public class ColorHashSharpBenchmarks
{
private const string STRING_TO_HASH = "The Force will be with you always";
private ColorHash _colorHash = new();
[Benchmark(Baseline = true)]
public void Hsl()
{
_ = _colorHash.Hsl(STRING_TO_HASH);
}
[Benchmark]
public void Rgb()
{
_ = _colorHash.Rgb(STRING_TO_HASH);
}
[Benchmark]
public void Hex()
{
_ = _colorHash.Hex(STRING_TO_HASH);
}
}
}