This is an automated email from the ASF dual-hosted git repository. aherbert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-rng.git
commit 431a51b8211a40e5e8d9df0406563d4873eb4eb6 Author: aherbert <aherb...@apache.org> AuthorDate: Wed Apr 10 11:01:05 2019 +0100 Disable redundant JMH benchmarks and mark as deprecated. --- .../rng/examples/jmh/GenerationPerformance.java | 21 ++++++++------ .../jmh/distribution/SamplersPerformance.java | 33 ++++++++++++---------- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/GenerationPerformance.java b/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/GenerationPerformance.java index 6b4e993..741c510 100644 --- a/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/GenerationPerformance.java +++ b/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/GenerationPerformance.java @@ -17,7 +17,6 @@ package org.apache.commons.rng.examples.jmh; -import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; @@ -33,6 +32,9 @@ import java.util.concurrent.TimeUnit; /** * Executes benchmark to compare the speed of generation of random numbers * from the various source providers. + * + * @deprecated Replaced by benchmarks for each method, for example + * {@link NextDoubleGenerationPerformance}. */ @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.MICROSECONDS) @@ -40,6 +42,7 @@ import java.util.concurrent.TimeUnit; @Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS) @State(Scope.Benchmark) @Fork(value = 1, jvmArgs = {"-server", "-Xms128M", "-Xmx128M"}) +@Deprecated public class GenerationPerformance { /** * Number of random values to generate. @@ -51,7 +54,7 @@ public class GenerationPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void nextBoolean(RandomSources sources, Blackhole bh) { for (int i = 0; i < numValues; i++) { @@ -63,7 +66,7 @@ public class GenerationPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void nextInt(RandomSources sources, Blackhole bh) { for (int i = 0; i < numValues; i++) { @@ -75,7 +78,7 @@ public class GenerationPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void nextIntN(RandomSources sources, Blackhole bh) { final int n = 10; @@ -88,7 +91,7 @@ public class GenerationPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void nextLong(RandomSources sources, Blackhole bh) { for (int i = 0; i < numValues; i++) { @@ -100,7 +103,7 @@ public class GenerationPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void nextLongN(RandomSources sources, Blackhole bh) { final long n = 2L * Integer.MAX_VALUE; @@ -113,7 +116,7 @@ public class GenerationPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void nextFloat(RandomSources sources, Blackhole bh) { for (int i = 0; i < numValues; i++) { @@ -125,7 +128,7 @@ public class GenerationPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void nextDouble(RandomSources sources, Blackhole bh) { for (int i = 0; i < numValues; i++) { @@ -137,7 +140,7 @@ public class GenerationPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void nextBytes(RandomSources sources, Blackhole bh) { final byte[] result = new byte[numValues]; diff --git a/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/distribution/SamplersPerformance.java b/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/distribution/SamplersPerformance.java index 727b00b..1a5344e 100644 --- a/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/distribution/SamplersPerformance.java +++ b/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/distribution/SamplersPerformance.java @@ -17,7 +17,6 @@ package org.apache.commons.rng.examples.jmh.distribution; -import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; @@ -48,6 +47,9 @@ import org.apache.commons.rng.sampling.distribution.PoissonSampler; /** * Executes benchmark to compare the speed of generation of random numbers * from the various source providers. + * + * @deprecated Replaced by {@link ContinuousSamplersPerformance} and + * {@link DiscreteSamplersPerformance}. */ @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.MICROSECONDS) @@ -55,6 +57,7 @@ import org.apache.commons.rng.sampling.distribution.PoissonSampler; @Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS) @State(Scope.Benchmark) @Fork(value = 1, jvmArgs = {"-server", "-Xms128M", "-Xmx128M"}) +@Deprecated public class SamplersPerformance { /** Number of samples per run. */ private static final int NUM_SAMPLES = 10000000; @@ -91,7 +94,7 @@ public class SamplersPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void runBoxMullerNormalizedGaussianSampler(RandomSources sources, Blackhole bh) { runSample(new BoxMullerNormalizedGaussianSampler(sources.getGenerator()), bh); @@ -101,7 +104,7 @@ public class SamplersPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void runMarsagliaNormalizedGaussianSampler(RandomSources sources, Blackhole bh) { runSample(new MarsagliaNormalizedGaussianSampler(sources.getGenerator()), bh); @@ -111,7 +114,7 @@ public class SamplersPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void runZigguratNormalizedGaussianSampler(RandomSources sources, Blackhole bh) { runSample(new ZigguratNormalizedGaussianSampler(sources.getGenerator()), bh); @@ -121,7 +124,7 @@ public class SamplersPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void runAhrensDieterExponentialSampler(RandomSources sources, Blackhole bh) { runSample(new AhrensDieterExponentialSampler(sources.getGenerator(), 4.56), bh); @@ -131,7 +134,7 @@ public class SamplersPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void runAhrensDieterMarsagliaTsangGammaSampler(RandomSources sources, Blackhole bh) { runSample(new AhrensDieterMarsagliaTsangGammaSampler(sources.getGenerator(), 9.8, 0.76), bh); @@ -141,7 +144,7 @@ public class SamplersPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void runBoxMullerLogNormalSampler(RandomSources sources, Blackhole bh) { runSample(new LogNormalSampler(new BoxMullerNormalizedGaussianSampler(sources.getGenerator()), 12.3, 4.6), bh); @@ -151,7 +154,7 @@ public class SamplersPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void runMarsagliaLogNormalSampler(RandomSources sources, Blackhole bh) { runSample(new LogNormalSampler(new MarsagliaNormalizedGaussianSampler(sources.getGenerator()), 12.3, 4.6), bh); @@ -161,7 +164,7 @@ public class SamplersPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void runZigguratLogNormalSampler(RandomSources sources, Blackhole bh) { runSample(new LogNormalSampler(new ZigguratNormalizedGaussianSampler(sources.getGenerator()), 12.3, 4.6), bh); @@ -171,7 +174,7 @@ public class SamplersPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void runChengBetaSampler(RandomSources sources, Blackhole bh) { runSample(new ChengBetaSampler(sources.getGenerator(), 0.45, 6.7), bh); @@ -181,7 +184,7 @@ public class SamplersPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void runContinuousUniformSampler(RandomSources sources, Blackhole bh) { runSample(new ContinuousUniformSampler(sources.getGenerator(), 123.4, 5678.9), bh); @@ -191,7 +194,7 @@ public class SamplersPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void runDiscreteUniformSampler(RandomSources sources, Blackhole bh) { runSample(new DiscreteUniformSampler(sources.getGenerator(), -98, 76), bh); @@ -201,7 +204,7 @@ public class SamplersPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void runRejectionInversionZipfSampler(RandomSources sources, Blackhole bh) { runSample(new RejectionInversionZipfSampler(sources.getGenerator(), 43, 2.1), bh); @@ -211,7 +214,7 @@ public class SamplersPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void runPoissonSampler(RandomSources sources, Blackhole bh) { runSample(new PoissonSampler(sources.getGenerator(), 8.9), bh); @@ -221,7 +224,7 @@ public class SamplersPerformance { * @param sources Source of randomness. * @param bh Data sink. */ - @Benchmark + //@org.openjdk.jmh.annotations.Benchmark public void runGeometricSampler(RandomSources sources, Blackhole bh) { runSample(new GeometricSampler(sources.getGenerator(), 0.21), bh);