experiments/csharp/E023-MathEstimateBenchmarks/Program.cs

21 lines
597 B
C#
Raw Permalink Normal View History

2024-05-04 20:16:52 +00:00
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
BenchmarkRunner.Run<MathEstimateBenchmarks>();
[SimpleJob, MemoryDiagnoser(false)]
public class MathEstimateBenchmarks
{
[Benchmark, Arguments(10)]
public double OneOverX(double x) => 1.0 / x;
[Benchmark, Arguments(10)]
public double ReciprocalEstimate(double x) => Math.ReciprocalEstimate(x);
[Benchmark, Arguments(10)]
public double OneOverSqrtX(double x) => 1.0 / Math.Sqrt(x);
[Benchmark, Arguments(10)]
public double ReciprocalSqrtEstimate(double x) => Math.ReciprocalSqrtEstimate(x);
}