Skip to content

Commit c207725

Browse files
committed
comments
1 parent b071492 commit c207725

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/test/java/de/tilman_neumann/jml/primes/exact/TDivPrimeTestPerformanceTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020

2121
import de.tilman_neumann.util.ConfigUtil;
2222

23+
/**
24+
* Compare performance of prime tests for N<2^31.
25+
*
26+
* Currently fastest is LEMIRE_INT_TEST.isPrimeUnrolled(n).
27+
*
28+
* But since there are just 105.097.565 primes < 2^31 (Integer.MAX_VALUE = 2^31 - 1 being the biggest)
29+
* and 203.280.221 primes < 2^32, maybe soon we will simply store them and look then up...
30+
*/
2331
public class TDivPrimeTestPerformanceTest {
2432
private static final Logger LOG = LogManager.getLogger(TDivPrimeTestPerformanceTest.class);
2533

src/test/java/de/tilman_neumann/jml/primes/exact/TDivPrimeTestTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@
2222

2323
import de.tilman_neumann.util.ConfigUtil;
2424

25+
/**
26+
* Tests correctness of prime tests for N<2^31.
27+
*
28+
* Comparing the results of (established reference algorithm) BARRETT_TEST.isPrime_v1(n)
29+
* with (currently fastest) LEMIRE_INT_TEST.isPrimeUnrolled(n)
30+
* for all odd N<2^31 takes less than 10 minutes and shows no errors.
31+
*/
2532
public class TDivPrimeTestTest {
2633
private static final Logger LOG = LogManager.getLogger(TDivPrimeTestTest.class);
2734

@@ -42,7 +49,7 @@ public void testTDivPrimeTest() {
4249
test(2565572);
4350

4451
// test many odd numbers
45-
for (int n=3; n < 10000000; n+=2) {
52+
for (int n=3; n <= 10000000 /* Integer.MAX_VALUE */; n+=2) {
4653
test(n);
4754
}
4855

0 commit comments

Comments
 (0)