Class SinCosPerformance

  • Direct Known Subclasses:
    SinCosPerformance_jmhType_B1

    public class SinCosPerformance
    extends Object
    Executes a benchmark to estimate the speed of sin/cos operations. This compares the Math implementation to FastMath. It would be possible to adapt FastMath to compute sin/cos together as they both use a common initial stage to map the value to the domain [0, pi/2).
    • Constructor Detail

      • SinCosPerformance

        public SinCosPerformance()
    • Method Detail

      • mathSin2

        public void mathSin2​(SinCosPerformance.Numbers numbers,
                             org.openjdk.jmh.infra.Blackhole bh)
        Explicit benchmark without using a method reference. This is commented out as it exists for reference purposes.
        Parameters:
        numbers - Numbers.
        bh - Data sink.
      • baselineIdentity

        public void baselineIdentity​(SinCosPerformance.Numbers numbers,
                                     org.openjdk.jmh.infra.Blackhole bh)
        Baseline the JMH overhead for all the benchmarks that create numbers. All other methods are expected to be slower than this.
        Parameters:
        numbers - Numbers.
        bh - Data sink.
      • fastMathSin

        public void fastMathSin​(SinCosPerformance.Numbers numbers,
                                org.openjdk.jmh.infra.Blackhole bh)
        Benchmark FastMath.sin(double).
        Parameters:
        numbers - Numbers.
        bh - Data sink.
      • fastMathCos

        public void fastMathCos​(SinCosPerformance.Numbers numbers,
                                org.openjdk.jmh.infra.Blackhole bh)
        Benchmark FastMath.cos(double).
        Parameters:
        numbers - Numbers.
        bh - Data sink.
      • rangeFastMathSin

        public void rangeFastMathSin​(SinCosPerformance.UniformNumbers numbers,
                                     org.openjdk.jmh.infra.Blackhole bh)
        Benchmark FastMath.sin(double) using a uniform range of numbers.
        Parameters:
        numbers - Numbers.
        bh - Data sink.