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
The following commit(s) were added to refs/heads/master by this push:
new bedc55f Add Integer/Long seed creation time benchmark.
bedc55f is described below
commit bedc55f611fe2305ba411f50e073f1a43e8dff6d
Author: Alex Herbert <[email protected]>
AuthorDate: Sun Jun 2 21:25:53 2019 +0100
Add Integer/Long seed creation time benchmark.
---
.../rng/examples/jmh/ConstructionPerformance.java | 30 +++++++++++++++++++---
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git
a/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/ConstructionPerformance.java
b/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/ConstructionPerformance.java
index 4c36838..61678a2 100644
---
a/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/ConstructionPerformance.java
+++
b/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/ConstructionPerformance.java
@@ -457,8 +457,7 @@ public class ConstructionPerformance {
@State(Scope.Benchmark)
public static class IntSizes {
/** The number of values. */
- @Param({"1",
- "2",
+ @Param({"2",
"4",
"32",
"128", // Legacy limit on array size generation
@@ -485,8 +484,7 @@ public class ConstructionPerformance {
@State(Scope.Benchmark)
public static class LongSizes {
/** The number of values. */
- @Param({"1",
- "2",
+ @Param({"2",
"4",
"8",
"16",
@@ -912,4 +910,28 @@ public class ConstructionPerformance {
bh.consume(SeedFactory.createLongArray(sizes.getSize()));
}
}
+
+ /**
+ * @param sizes Size of {@code int[]} seed.
+ * @param bh Data sink.
+ */
+ @Benchmark
+ public void createIntegerSeed(IntSizes sizes, Blackhole bh) {
+ for (int i = 0; i < SEEDS; i++) {
+ // This has to be boxed to an object
+ bh.consume(Integer.valueOf(SeedFactory.createInt()));
+ }
+ }
+
+ /**
+ * @param sizes Size of {@code long[]} seed.
+ * @param bh Data sink.
+ */
+ @Benchmark
+ public void createLongSeed(LongSizes sizes, Blackhole bh) {
+ for (int i = 0; i < SEEDS; i++) {
+ // This has to be boxed to an object
+ bh.consume(Long.valueOf(SeedFactory.createLong()));
+ }
+ }
}