File tree 1 file changed +9
-4
lines changed
commons-numbers-examples/examples-jmh/src/main/java/org/apache/commons/numbers/examples/jmh/core
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 22
22
import org .openjdk .jmh .annotations .Benchmark ;
23
23
import org .openjdk .jmh .annotations .BenchmarkMode ;
24
24
import org .openjdk .jmh .annotations .Fork ;
25
+ import org .openjdk .jmh .annotations .Level ;
25
26
import org .openjdk .jmh .annotations .Measurement ;
26
27
import org .openjdk .jmh .annotations .Mode ;
27
28
import org .openjdk .jmh .annotations .Param ;
@@ -58,7 +59,7 @@ public static class Ints {
58
59
/**
59
60
* The number of number pairs to generate.
60
61
*/
61
- @ Param ("1000 " )
62
+ @ Param ("100000 " )
62
63
private int numPairs ;
63
64
64
65
/**
@@ -69,12 +70,14 @@ public static class Ints {
69
70
/**
70
71
* JMH setup method to generate the data.
71
72
*/
72
- @ Setup
73
+ @ Setup ( Level . Iteration )
73
74
public void setup () {
74
75
values = getRandomProvider (seed ).ints ()
75
76
.filter (i -> i != Integer .MIN_VALUE ).
76
77
limit (numPairs * 2 )
77
78
.toArray ();
79
+
80
+ seed = (((long ) values [0 ]) << Integer .SIZE ) | values [1 ];
78
81
}
79
82
}
80
83
@@ -92,7 +95,7 @@ public static class Longs {
92
95
/**
93
96
* The number of number pairs to generate.
94
97
*/
95
- @ Param ("1000 " )
98
+ @ Param ("100000 " )
96
99
private int numPairs ;
97
100
98
101
/**
@@ -103,12 +106,14 @@ public static class Longs {
103
106
/**
104
107
* JMH setup method to generate the data.
105
108
*/
106
- @ Setup
109
+ @ Setup ( Level . Iteration )
107
110
public void setup () {
108
111
values = getRandomProvider (seed ).longs ()
109
112
.filter (i -> i != Long .MIN_VALUE )
110
113
.limit (numPairs * 2 )
111
114
.toArray ();
115
+
116
+ seed = values [0 ];
112
117
}
113
118
}
114
119
You can’t perform that action at this time.
0 commit comments