Skip to content

Commit 9a48aaa

Browse files
committed
Add Benchmark
1 parent db723db commit 9a48aaa

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright (c) Six Labors.
2+
// Licensed under the Six Labors Split License.
3+
4+
using System.Numerics;
5+
using BenchmarkDotNet.Attributes;
6+
using SixLabors.ImageSharp.Processing;
7+
8+
namespace SixLabors.ImageSharp.Benchmarks.General.Vectorization;
9+
10+
[Config(typeof(Config.MultiFramework))]
11+
public class ColorNumerics
12+
{
13+
private static Vector4[] input =
14+
{
15+
new(.5F), new(.5F), new(.5F), new(.5F), new(.5F), new(.5F), new(.5F),
16+
};
17+
18+
[Benchmark]
19+
public Vector4 Transform()
20+
{
21+
Vector4 input = new(.5F);
22+
ColorMatrix matrix = KnownFilterMatrices.CreateHueFilter(45F);
23+
ImageSharp.ColorNumerics.Transform(ref input, ref matrix);
24+
25+
return input;
26+
}
27+
28+
[Benchmark]
29+
public void Transform_Span()
30+
{
31+
ColorMatrix matrix = KnownFilterMatrices.CreateHueFilter(45F);
32+
ImageSharp.ColorNumerics.Transform(input.AsSpan(), ref matrix);
33+
}
34+
}

0 commit comments

Comments
 (0)