Browse Source

Update Colorful and add Pow benchmark

pull/595/head
James Jackson-South 8 years ago
parent
commit
ce4d4bfb1a
  1. 40
      tests/ImageSharp.Benchmarks/General/Pow.cs
  2. 2
      tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj

40
tests/ImageSharp.Benchmarks/General/Pow.cs

@ -0,0 +1,40 @@
using System;
using BenchmarkDotNet.Attributes;
namespace SixLabors.ImageSharp.Benchmarks.General
{
public class Pow
{
[Params(-1.333F, 1.333F)]
public float X { get; set; }
[Benchmark(Baseline = true, Description = "Math.Pow 2")]
public float MathPow()
{
float x = this.X;
return (float)Math.Pow(x, 2);
}
[Benchmark(Description = "Pow x2")]
public float PowMult()
{
float x = this.X;
return x * x;
}
[Benchmark(Description = "Math.Pow 3")]
public float MathPow3()
{
float x = this.X;
return (float)Math.Pow(x, 3);
}
[Benchmark(Description = "Pow x3")]
public float PowMult3()
{
float x = this.X;
return x * x * x;
}
}
}

2
tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj

@ -15,7 +15,7 @@
<Compile Include="..\ImageSharp.Tests\TestUtilities\TestEnvironment.cs" Link="Tests\TestEnvironment.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Colourful" Version="1.1.2" />
<PackageReference Include="Colourful" Version="1.2.1" />
<PackageReference Include="System.Numerics.Vectors" Version="4.4.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net461'">

Loading…
Cancel
Save