20110823, 07:33  #45 
Jun 2003
2^{5}·5·31 Posts 

20110823, 07:33  #46 
Mar 2009
2·19 Posts 
Any time for the original problem of JohnFullspeed for 10000000# mod 50847533 that is greater than say 1 ms, shows that used implementation is bad: Since 50847533 = 11*31*149113, the result is zero after reaching 149113.

20110823, 08:05  #47 
Jun 2003
2^{5}·5·31 Posts 
Some actual data:
Code:
for i:=1 to 5761455 do m := (m * prime[i]) mod r; Code:
for i:=1 to 5761455 do begin x := prime[i]; asm movl m, %eax mull x divl r movl %edx, m end; end; All timings on a 2 GHz core2 in 32bit mode. With little bit more optimization (mainly, keeping the variables in register, LOL), we can come closer to the theoretical prediction. Last fiddled with by axn on 20110823 at 08:11 
20110823, 08:23  #48  
May 2011
France
7·23 Posts 
Quote:
If your value is smaller that the size of the register then the processor is ALWAYS the speeder Wit actual the lib are used when the ize is more 64 bits before the difference is a hardware difference: I change S to := 45089156699671; and I need LESS time!!! The processor is speeder doing a mod 64 thant a 32. In fact it's normal more the medulo is big more it's speed: it's trivial else change your lib... inn fact I remove mod ,after th mul and and emppty bS BCL The times are Full version : 200 600=1 second Remove mod : 182 Remove mul : 172 empty : 150 Mod and Div are well neer 1 cycle The problem arrives after 64 bits you fave to write a mul,a div,a root with numbers in a vector You have big diferennnces but the user believe that a mod 1000 digits is slover than a 2 digits and that is normal to wait day John 

20110823, 08:34  #49  
May 2011
France
7×23 Posts 
Error
Quote:
implementation is not bad: it needs 'reglages' John 

20110823, 08:55  #50  
Mar 2009
2·19 Posts 
Quote:
Please repeat your test with S=45089156699693! Are there any references that multiply with 0 and dividing a zero is optimized on recent processors? 

20110823, 10:25  #51 
May 2011
France
7×23 Posts 
S?
S was a copy and paste...
I change s with your value : same time In the actual processor a divide by zero always make a crash and for the mul is the same: mul by 0 or mul by 1234568 need the same time : no specific code John The dif beetwen CISC and RISC are somtimes funy if you use factoring by divwe try to remove div to a dd the code is speeder But if you make it on a CVisc the result is slover The same optimization make the inverse! John 
20110823, 11:02  #52  
Jun 2003
2^{5}·5·31 Posts 
Quote:
What are the details of the processor  type, clock speed, cache size  that you're using? I am trying to figure out which brain dead processor takes 150ms to execute a 500,000 iteration empty loop! 

20110823, 12:19  #53 
"Forget I exist"
Jul 2009
Dumbassville
2^{6}·131 Posts 
in pari mine take 94 ms in one test.

20110823, 16:08  #54 
May 2011
France
7·23 Posts 
processor
I cjhange my core 2for a G5
I ndide you havre a power 4 : two ptocdrsoo G5or at 1,7 giga heertz 3 giga DDR SDRAM Version du système : Mac OS X 10.4.11 (8S165) Version Kernel : Darwin 8.11.0 Volume de démarrage : Mac Nom de l’ordinateur : Power Mac G5 de PM G5 Nom de l’utilisateur : PM G5 (pmg5) I use the nehendertal FREE PASCAAL ffor MIPS,ARM800 and asmall constructor (IIBM , uou knox) You seems to be meticulos Beffore to laungth give the real time noit tha trhrotiy I give the code for a CIDC So givve the time to [CODE] a1 := GetTickCount; S:= 45089156699671; G1:= 1 ; i1:=1; Repeat G1:=(G1*Primes[i1]) mod s; i1:= I1+1; until i1=5761456; a1 := GetTickCounta1; Not difficult for you juste the ptimorial 10^7 (You prefere 2^32) AFter if it's possible for you change the mod by a mul a1 := GetTickCount; S:= 45089156699671; G1:= 1 ; i1:=1; Repeat G1:=(G1*Primes[i1]) 0* s; perhaps to big for you i1:= I1+1; until i1=5761456; a1 := GetTickCounta1; and last change for a ADD a1 := GetTickCount; S:= 45089156699671; G1:= 1 ; i1:=1; Repeat G1:=(G1*Primes[i1]) + s; i1:= I1+1; until i1=5761456; a1 := GetTickCounta1; ande if ou have a scientifique spirir try empèye repeat a1 := GetTickCount; S:= 45089156699671; G1:= 1 ; i1:=1; Repeat G1:=(G1*Primes[i1]) + s; i1:= I1+1; until i1=5761456; a1 := GetTickCounta1; If you don't understand the repeat do a for (you have it?) It's strange I giove the time but I never have yoour Of courde I bneleive yoou I don't restartmy core 2 to verify your time 0.128 0182 .0130 0.024 second And you Core 2.4 Gisa 4 GO of ram Wndows,Linux FreeePascal or C But the time is not mine it' the time of the processor I work 10 years on CISC and now I search the speeder... I baughth my Mac in JUNE: 250 euros 
20110829, 14:32  #55  
"Robert Gerbicz"
Oct 2005
Hungary
1466_{10} Posts 
Quote:
Quote:
So interestingly with a single computer it was possible to beat a boinc project, their goal was to test all primes up to 4billions, and as I can see they are at ~2.3billions. 

Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
World Record Factorial Prime Found  rogue  Lounge  8  20120302 16:41 
square root modulo prime  Raman  Math  1  20100216 21:25 
Order of 3 modulo a Mersenne prime  T.Rex  Math  7  20090313 10:46 
Period of Lucas Sequence modulo a prime  T.Rex  Math  7  20070604 21:30 
Conjecture about multiplicative order of 3 modulo a Mersenne prime  T.Rex  Math  9  20070326 17:35 