Improved performance of MinMax on Images

This commit is contained in:
DarthAffe committed 2024-08-20 21:21:38 +02:00
1 parent e6b77ecfdb
commit f091aadd92
10 files changed
+134 -65

No files matched your search

+25
View File
@@ -13,6 +13,8 @@ public class MinMaxBenchmarks
private readonly List<ColorRGB[]> _colors3bpp;
private readonly List<ColorRGBA[]> _colors4bpp;
private readonly List<IImage<ColorRGB>> _images3bpp;
private readonly List<IImage<ColorRGBA>> _images4bpp;
#endregion
@@ -22,6 +24,9 @@ public class MinMaxBenchmarks
{
_colors3bpp = BenchmarkHelper.GetSampleData<ColorRGB>();
_colors4bpp = BenchmarkHelper.GetSampleData<ColorRGBA>();
_images3bpp = BenchmarkHelper.GetSampleDataImages<ColorRGB>();
_images4bpp = BenchmarkHelper.GetSampleDataImages<ColorRGBA>();
}
#endregion
@@ -48,6 +53,26 @@ public class MinMaxBenchmarks
return minMax;
}
[Benchmark]
public IMinMax[] PixelHelper_3BPP_Image()
{
IMinMax[] minMax = new IMinMax[_images3bpp.Count];
for (int i = 0; i < _images3bpp.Count; i++)
minMax[i] = _images3bpp[i].MinMax();
return minMax;
}
[Benchmark]
public IMinMax[] PixelHelper_4BPP_Image()
{
IMinMax[] minMax = new IMinMax[_images4bpp.Count];
for (int i = 0; i < _images4bpp.Count; i++)
minMax[i] = _images4bpp[i].MinMax();
return minMax;
}
[Benchmark]
public IMinMax[] Reference_3BPP()
{