mirror of https://github.com/SixLabors/ImageSharp
2 changed files with 41 additions and 1 deletions
@ -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; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue