@@ -76,6 +76,9 @@ private enum TestMode {
7676 private static final Integer MAX_BITS = 31 ;
7777 /** each algorithm is run REPEATS times for each input in order to reduce GC influence on timings */
7878 private static final int REPEATS = 1 ;
79+ /** number of warmup rounds */
80+ private static final int WARUMPS = 0 ;
81+
7982 /** Nature of test numbers */
8083 private static final TestNumberNature TEST_NUMBER_NATURE = TestNumberNature .MODERATE_SEMIPRIMES ;
8184 /** Test mode */
@@ -221,7 +224,7 @@ private void testRange(int bits) {
221224
222225 // take REPEATS timings for each algorithm to be quite sure that one timing is not falsified by garbage collection
223226 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 ++) {
225228 for (FactorAlgorithm algorithm : algorithms ) {
226229 // exclude special size implementations
227230 String algName = algorithm .getName ();
@@ -259,7 +262,7 @@ private void testRange(int bits) {
259262 duration = endTimeMillis - startTimeMillis ; // duration in ms
260263 //LOG.debug("algorithm " + algName + " finished test set with " + bits + " bits");
261264
262- if (i ==0 ) {
265+ if (round ==0 ) {
263266 // test correctness
264267 for (int j =0 ; j <N_COUNT ; j ++) {
265268 BigInteger N = testNumbers [j ];
@@ -290,7 +293,7 @@ private void testRange(int bits) {
290293 duration = endTimeMillis - startTimeMillis ; // duration in ms
291294 //LOG.debug("algorithm " + algName + " finished test set with " + bits + " bits");
292295
293- if (i ==0 ) {
296+ if (round ==0 ) {
294297 // test correctness
295298 for (int j =0 ; j <N_COUNT ; j ++) {
296299 BigInteger N = testNumbers [j ];
@@ -331,15 +334,15 @@ private void testRange(int bits) {
331334 default : throw new IllegalArgumentException ("TestMode = " + TEST_MODE );
332335 }
333336
334- if (i > 0 ) {
337+ if (round >= WARUMPS ) {
335338 // add performance results
336339 List <FactorAlgorithm > algList = ms_2_algorithms .get (duration );
337340 if (algList ==null ) algList = new ArrayList <FactorAlgorithm >();
338341 algList .add (algorithm );
339342 ms_2_algorithms .put (duration , algList );
340343 }
341344
342- if (i ==0 ) {
345+ if (round ==0 ) {
343346 // failure summary
344347 if (failCount >0 ) {
345348 LOG .error ("FactorAlgorithm " + algorithm .getName () + " failed at " + failCount + "/" + N_COUNT + " test numbers" );
0 commit comments