![]() |
![]() |
#34 |
Tribal Bullet
Oct 2004
2·3·19·31 Posts |
![]()
The MPQS code in GGNFS was incredibly fast back when I tested it; the ECM code in CADO-NFS is also blazing fast for ranges of inputs that are above the sizes discussed here (64-128 bits).
If you want another (not well optimized) SIQS, I wrote this in 2005 and modernized it a short while ago. |
![]() |
![]() |
![]() |
#35 | |
"Dana Jacobsen"
Feb 2011
Bangkok, TH
38C16 Posts |
![]() Quote:
The cof-siqs run on the semiprime set does quite poorly at small bit sizes. It misses factoring a few at each size so would need a backup. It looks like it outperforms smallmpqs on the data sets I have (which stop at 64-bit). At 63-bit it's close but Ben's new Pollard-Rho beats it as does mine when I use his new mulredc. At 64-bit it is ~30% faster than my native Pollard-Rho, about 10% faster than Ben's 64-bit version, and factor63 doesn't handle that size. |
|
![]() |
![]() |
![]() |
#36 |
"Andrew Booker"
Mar 2013
1258 Posts |
![]()
Here are few ideas for improving factor63 that I had after reading recent posts. Any opinions?
|
![]() |
![]() |
![]() |
#37 | |
"Ben"
Feb 2007
3,371 Posts |
![]() Quote:
2) A small up front cost is fine for most of the projects that I imagine would use factor63 since it would be greatly amortized. That said, the systems I've been running it on seem to cache it just fine (real ~= user) 3) I'm leaning toward no, mostly because of the additional file size and because my pbrent routine is now within about 1% or even slightly faster than factor63, using no table. But admittedly that is for the specialized semiprime problem, not for general inputs. And also the speed of my pbrent routine I think mostly comes from an assembler implementation of mulredc/addmod, which you are welcome to use (P.M me if interested), and that would likely put factor63 solidly in the lead again. |
|
![]() |
![]() |
![]() |
#38 |
"Ben"
Feb 2007
3,371 Posts |
![]()
Here are some quick comparisons. "rand" is the first test we tried with inputs from an LCG. I haven't tried "rand" with the new pbrent yet - it needs a recipe for checking isprime, finding small factors, etc., before trying that test.
Code:
bits pbrent f63 f63-asm 48 3.6 4.2 3.9 55 11.3 13.3 12.2 60 27.4 26.5 24.2 rand -- 1.62 1.47 |
![]() |
![]() |
![]() |
#39 | |||||
"Andrew Booker"
Mar 2013
5×17 Posts |
![]() Quote:
Quote:
Quote:
Quote:
Quote:
|
|||||
![]() |
![]() |
![]() |
#40 | ||||
"Dana Jacobsen"
Feb 2011
Bangkok, TH
22·227 Posts |
![]() Quote:
Quote:
Quote:
Quote:
|
||||
![]() |
![]() |
![]() |
#41 | |
"Ben"
Feb 2007
3,371 Posts |
![]() Quote:
I don't really view this as a competition, but a competitive angle does sometimes provide motivation :) |
|
![]() |
![]() |
![]() |
#42 |
"Dana Jacobsen"
Feb 2011
Bangkok, TH
11100011002 Posts |
![]()
Nvm on the test update. I got confused by the terms "psp" and "Fermat test" in the code. You're doing a Miller-Rabin aka strong pseudoprime test already.
For 32-bit inputs you could use a small hash table of bases so only one test is necessary for correct answers, though you're already using your big factor table for most of that range, and it doesn't materially change your table size. After that I guess your choice of big table (memory cost), two tests and a ~1M entry table (+1x CPU, still some memory cost), or a Lucas test and no table (+1.5x CPU, no memory). There are hashed 2-M-R test solutions but they only go to ~49 bits which doesn't seem to really help you. Ben is right that Warren D. Smith wrote the Lehman implementation which has had minor changes since. My HOLF implementation seems to do well at small sizes -- more testing would be useful here for those few people that care about microsecond differences in factoring 17- to 32-bit composites. 32-bit to 42-bit where Pollard-Rho crosses HOLF/Lehman is another interesting range. From 42- to 63-bit so far it seems the optimized Pollard-Rho implementations are winning. |
![]() |
![]() |
![]() |
#43 | |
"Andrew Booker"
Mar 2013
5×17 Posts |
![]() Quote:
I'm experimenting with a 64-bit version using Ben's asm mulredc. One thing that surprised me is how much time is saved in factor63 by using the Sylvester sequence, which allowed me to replace one addmod by a simple addition (the line y = mulredc(y,y+one)). For 64 bits we need to use addmod (or submod, which is slightly quicker), and that single change adds more time than the savings from using asm mulredc. (On the bright side, this shows how close to the bone we're cutting in the code.) I noticed that Ben's routine handles 63-bit and 64-bit n separately, and I might just move the if check farther out so the penalty is only incurred for 64-bit numbers. |
|
![]() |
![]() |
![]() |
#44 |
"Ben"
Feb 2007
1101001010112 Posts |
![]()
This is a new one for me... do you have a reference you could point me to? I was wondering was kind of iteration was going on in your code. I had assumed there was an addmod buried in there somewhere that I wasn't smart enough to find.
|
![]() |
![]() |
![]() |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Factoring Mersenne numbers | paulunderwood | Miscellaneous Math | 18 | 2017-08-27 14:56 |
Factoring Big Numbers In c# | ShridharRasal | Factoring | 10 | 2008-03-20 17:17 |
Question about factoring code | Peter Nelson | Software | 9 | 2005-03-30 18:28 |
Factoring Fermat Numbers | Axel Fox | Software | 14 | 2003-07-04 18:57 |
Questions about SSE2 code and Factoring | Joe O | Software | 2 | 2002-09-13 23:39 |