@@ -76,6 +76,9 @@ private enum TestMode {
76
76
private static final Integer MAX_BITS = 31 ;
77
77
/** each algorithm is run REPEATS times for each input in order to reduce GC influence on timings */
78
78
private static final int REPEATS = 1 ;
79
+ /** number of warmup rounds */
80
+ private static final int WARUMPS = 0 ;
81
+
79
82
/** Nature of test numbers */
80
83
private static final TestNumberNature TEST_NUMBER_NATURE = TestNumberNature .MODERATE_SEMIPRIMES ;
81
84
/** Test mode */
@@ -221,7 +224,7 @@ private void testRange(int bits) {
221
224
222
225
// take REPEATS timings for each algorithm to be quite sure that one timing is not falsified by garbage collection
223
226
TreeMap <Long , List <FactorAlgorithm >> ms_2_algorithms = new TreeMap <Long , List <FactorAlgorithm >>();
224
- for (int i =0 ; i < REPEATS + 1 ; i ++) { // round 0 is a warmup-round
227
+ for (int round =0 ; round < WARUMPS + REPEATS ; round ++) {
225
228
for (FactorAlgorithm algorithm : algorithms ) {
226
229
// exclude special size implementations
227
230
String algName = algorithm .getName ();
@@ -259,7 +262,7 @@ private void testRange(int bits) {
259
262
duration = endTimeMillis - startTimeMillis ; // duration in ms
260
263
//LOG.debug("algorithm " + algName + " finished test set with " + bits + " bits");
261
264
262
- if (i ==0 ) {
265
+ if (round ==0 ) {
263
266
// test correctness
264
267
for (int j =0 ; j <N_COUNT ; j ++) {
265
268
BigInteger N = testNumbers [j ];
@@ -290,7 +293,7 @@ private void testRange(int bits) {
290
293
duration = endTimeMillis - startTimeMillis ; // duration in ms
291
294
//LOG.debug("algorithm " + algName + " finished test set with " + bits + " bits");
292
295
293
- if (i ==0 ) {
296
+ if (round ==0 ) {
294
297
// test correctness
295
298
for (int j =0 ; j <N_COUNT ; j ++) {
296
299
BigInteger N = testNumbers [j ];
@@ -331,15 +334,15 @@ private void testRange(int bits) {
331
334
default : throw new IllegalArgumentException ("TestMode = " + TEST_MODE );
332
335
}
333
336
334
- if (i > 0 ) {
337
+ if (round >= WARUMPS ) {
335
338
// add performance results
336
339
List <FactorAlgorithm > algList = ms_2_algorithms .get (duration );
337
340
if (algList ==null ) algList = new ArrayList <FactorAlgorithm >();
338
341
algList .add (algorithm );
339
342
ms_2_algorithms .put (duration , algList );
340
343
}
341
344
342
- if (i ==0 ) {
345
+ if (round ==0 ) {
343
346
// failure summary
344
347
if (failCount >0 ) {
345
348
LOG .error ("FactorAlgorithm " + algorithm .getName () + " failed at " + failCount + "/" + N_COUNT + " test numbers" );
0 commit comments