Skip to content

Commit 637c7b4

Browse files
committed
enable to run tests backwards in size +++ javadoc
1 parent a8c2f16 commit 637c7b4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/test/java/de/tilman_neumann/jml/factor/FactorizerTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@
4949
/**
5050
* Main class to compare the performance of factor algorithms.
5151
*
52-
* Does one warmup-round and a System.gc() before each algorithm is tested.
52+
* Unfortunately, the timing results produced by this class may be quite inaccurate.
53+
*
54+
* The main problem is that the Hotspot compiler optimizes the code from the first several thousand tests.
55+
* If you run tests from 50 to 100 bits, the code will be optimized for the 50 bit numbers and the results for 100 bit numbers will be quite inaccurate.
56+
*
57+
* I should be use scripts that restart the JVM for every new bitsize...
5358
*
5459
* @author Tilman Neumann
5560
*/
@@ -377,7 +382,8 @@ public static void main(String[] args) {
377382
// test N with the given number of bits, i.e. 2^(bits-1) <= N <= (2^bits)-1
378383
testEngine.testRange(bits);
379384
bits += INCR_BITS;
380-
if (MAX_BITS!=null && bits > MAX_BITS) break;
385+
// permit the generator to run from bigger to smaller test numbers, too
386+
if (MAX_BITS!=null && ((INCR_BITS > 0 && bits > MAX_BITS) || (INCR_BITS < 0 && bits < MAX_BITS))) break;
381387
}
382388
}
383389
}

0 commit comments

Comments
 (0)