Skip to content

Commit 1e41566

Browse files
committed
test small algorithms bottom-up
1 parent ff18ac1 commit 1e41566

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

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

+14-19
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ private enum TestMode {
7979
/** number of test numbers */
8080
private static final int N_COUNT = 100000;
8181
/** the bit size of N to start with */
82-
private static final int START_BITS = 45;
82+
private static final int START_BITS = 20;
8383
/** the increment in bit size from test set to test set */
8484
private static final int INCR_BITS = 5;
8585
/** maximum number of bits to test (no maximum if null) */
86-
private static final Integer MAX_BITS = 45;
86+
private static final Integer MAX_BITS = 20;
8787
/** each algorithm is run REPEATS times for each input in order to reduce GC influence on timings */
8888
private static final int REPEATS = 5;
8989
/** number of warmup rounds */
@@ -105,32 +105,27 @@ public FactorizerTest() {
105105
algorithms = new FactorAlgorithm[] {
106106

107107
// Trial division
108-
// new TDiv31(),
108+
new TDiv31(),
109109
new TDiv31Inverse(),
110110
new TDiv31Barrett(), // Fastest algorithm for N < 29 bit
111-
// new TDiv63(),
111+
new TDiv63(),
112112
new TDiv63Inverse(1<<21),
113-
// new TDiv().setTestLimit(1<<20),
113+
// new TDiv().setTestLimit(1<<21),
114114

115115
// Hart's one line factorizer
116116
//new HartSimple(),
117-
// new HartFast(false),
118-
// new HartFast(true),
119-
// new HartTDivRace(),
120-
// new HartTDivRace2(),
121-
// new HartSquarefree(false), // best algorithm for semiprime N for 29 to 37 bit
122-
// new HartFast2Mult(false), // best algorithm for semiprime N for 38 to 45 bit
123-
// new HartFast2MultFMA(false),
124-
// new HartMultiplierChainSqrtN(false),
117+
new HartFast(true),
118+
new HartTDivRace(),
119+
new HartTDivRace2(),
120+
new HartSquarefree(true), // best algorithm for semiprime N for 29 to 37 bit
125121
new HartFast2Mult(true), // best algorithm for semiprime N for 38 to 45 bit
126122
new HartFast2MultFMA(true),
127123
new HartFast2Mult2(true), // best algorithm for semiprime N for 38 to 45 bit
128124

129125
// Lehman
130126
//new LehmanSimple(false),
131127
//new LehmanSmith(false),
132-
// new LehmanFast(false), // the variant implemented by bsquared
133-
//new LehmanFast(true),
128+
new LehmanFast(true), // the variant implemented by bsquared
134129
new LehmanCustomKOrder(true),
135130

136131
// PollardRho
@@ -139,7 +134,7 @@ public FactorizerTest() {
139134
// new PollardRhoTwoLoops31(),
140135
new PollardRhoBrentMontgomery32(),
141136

142-
//new PollardRhoBrentMontgomery64(),
137+
new PollardRhoBrentMontgomery64(),
143138
new PollardRhoBrentMontgomery64MH(),
144139
new PollardRhoBrentMontgomery64MHInlined(),
145140

@@ -155,10 +150,10 @@ public FactorizerTest() {
155150
// * SquFoF31 works until 52 bit and is faster there than SquFoF63
156151
// * best multiplier sequence = 1680 * {squarefree sequence}
157152
// * best stopping criterion = O(5.th root(N))
158-
new SquFoF63(),
159153
//new SquFoF31(),
160154
new SquFoF31Preload(),
161-
155+
new SquFoF63(),
156+
162157
// CFrac
163158
// * never the best algorithm: SquFoF63 is better for N <= 65 bit, SIQS is better for N >= 55 bits
164159
// * stopRoot, stopMult: if big enough, then a second k is rarely needed; (5, 1.5) is good
@@ -171,7 +166,7 @@ public FactorizerTest() {
171166
// new CFrac63(true, 5, 1.5F, 0.152F, 0.25F, new TDiv_CF63_02(), new MatrixSolverGauss02(), 12),
172167

173168
// ECM
174-
// new TinyEcm64(true),
169+
new TinyEcm64(true),
175170
new TinyEcm64MH(true),
176171
new TinyEcm64MHInlined(true), // best algorithm for N from 46 to 62 bit
177172
// new EllipticCurveMethod(-1),

0 commit comments

Comments
 (0)