mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Programming

Reply
 
Thread Tools
Old 2017-01-02, 19:51   #45
Till
 
Till's Avatar
 
"Tilman Neumann"
Jan 2016
Germany

6238 Posts
Default

Hi Dario,
I tried to get the Java code of your old applets from your new location https://github.com/alpertron/calculators.git
But it does not compile? The main error is "factorApplet cannot be resolved to be a type"

I'ld like to see it work again :)
Best wishes
Till
Till is offline   Reply With Quote
Old 2017-01-03, 19:05   #46
alpertron
 
alpertron's Avatar
 
Aug 2002
Buenos Aires, Argentina

23×3×5×11 Posts
Default

You need all source files in order to compile the applet. You can download them from https://www.alpertron.com.ar/ecm.zip

Anyway, the idea for the new HTML5 application is to have the same functionality as the old applet. It takes a long time because I do it in my free time.

In a few days I will replace the applet by the HTML5 application, after I migrate everything except for the primality proving.

I want to replace the APRT-CLE primality algorithm by ECPP. So this will be done later.

It appears that in March, Firefox will be upgraded to version 52, which does not support NPAPI, so Java will be out.
alpertron is offline   Reply With Quote
Old 2017-01-04, 14:52   #47
Till
 
Till's Avatar
 
"Tilman Neumann"
Jan 2016
Germany

13×31 Posts
Default

Ok. But since you already put the applets on that github page, why do you not put all files there such that it compiles?
Till is offline   Reply With Quote
Old 2017-01-04, 16:25   #48
alpertron
 
alpertron's Avatar
 
Aug 2002
Buenos Aires, Argentina

23·3·5·11 Posts
Default

Quote:
Originally Posted by Till View Post
Ok. But since you already put the applets on that github page, why do you not put all files there such that it compiles?
You are right. It appears that I forgot the "git add" command on the missing files. I will do that tonight.
alpertron is offline   Reply With Quote
Old 2017-01-09, 17:47   #49
Till
 
Till's Avatar
 
"Tilman Neumann"
Jan 2016
Germany

13·31 Posts
Default

Now dilog.java won't compile. ecm.Typ and ecm.lModularMult are not visible in that class, and otherwise there seems to be an incompatibility caused by a conversion of some int[] to long[].
Till is offline   Reply With Quote
Old 2017-01-09, 23:46   #50
alpertron
 
alpertron's Avatar
 
Aug 2002
Buenos Aires, Argentina

23×3×5×11 Posts
Default

This is because I changed the file ecm.java since the last change to the discrete logarithm applet.

Since applets are not working anymore, I will not change those files. My goal is to have all applets converted to HTML5 applications.

The discrete logarithm HTML5 application is based on the applet. Notice that it is slow because it uses Pollard-rho algorithm. I will change that to index-calculus in the future, which is a lot faster, after all applets are converted.

I've just replaced the old factorization applet by the new HTML5 application at URL https://www.alpertron.com.ar/ECM.HTM

Please let me know if you find any error.

Last fiddled with by alpertron on 2017-01-09 at 23:59
alpertron is offline   Reply With Quote
Old 2017-01-10, 20:18   #51
Till
 
Till's Avatar
 
"Tilman Neumann"
Jan 2016
Germany

13·31 Posts
Default

I will. I already did a few simple factoring runs and the results look fine so far.

One question about your new architecture: As I understand, applets were run on the clients. How is that now with HTML 5, I'ld guess the main load is now on the server side?
Till is offline   Reply With Quote
Old 2017-01-10, 21:03   #52
alpertron
 
alpertron's Avatar
 
Aug 2002
Buenos Aires, Argentina

132010 Posts
Default

Thanks for testing the application.

The factorization occurs completely in the client. Furthermore the server cannot know what number is being factored because there are no cookies. In the applet, a cookie was used that held the factorization in progress, so the program could resume factorization when you restarted it.

In the new approach, the progress is saved in local storage instead of a cookie, so that information never goes out of the computer, except when you are trying to factor a Cunningham number and check the checkbox that gets known Cunningham factors from the Web server.
alpertron is offline   Reply With Quote
Old 2017-01-13, 17:04   #53
Till
 
Till's Avatar
 
"Tilman Neumann"
Jan 2016
Germany

13·31 Posts
Default

Quote:
Originally Posted by alpertron View Post
Please let me know if you find any error.
Hi Dario,
I believe there is a possible infinite loop in the binary search in PerformTrialDivision().
The binary search exists twice; in siqs.c the questionable statements (located in lines 1359 and 1659) are "left = median;"

The median M is computed in integers, thus M = L + lower((R-L)/2).
If R=L+1, then the lower()-part is 0, M=L, and assigning M to L has no effect -> infinite loop.

To fix it, use "left = median+1;"

Best regards
Till

Last fiddled with by Till on 2017-01-13 at 17:05 Reason: Fix
Till is offline   Reply With Quote
Old 2017-01-21, 19:46   #54
alpertron
 
alpertron's Avatar
 
Aug 2002
Buenos Aires, Argentina

23·3·5·11 Posts
Default

I changed the big integer algorithms to use both 32-bit integers and double precision floating point and now the ECM algorithm runs 2.5x faster. I compared it against 64-bit Java 1.8.0_121, and the applet on Eclipse runs 3 times faster than this new implementation.

Unfortunately Javascript does not have 64-bit integers, so I think that I will not be able to match the speed of Java.

I also fixed several errors which can be seen on GitHub.
alpertron is offline   Reply With Quote
Old 2017-04-17, 02:05   #55
alpertron
 
alpertron's Avatar
 
Aug 2002
Buenos Aires, Argentina

23·3·5·11 Posts
Default

Given that both Firefox and Chrome now support WebAssembly by default, and Edge also supports it by toggling a flag, I decided to change the source code of the factoring application in order to support this new environment.

It took almost a month but the run time is a lot better now.

The program now detects when the Web browser supports WebAssembly and uses it, otherwise it will use the asm.js version. In any case, the program shows in the screen which version is using.

These are the timings for WebAssembly version in a Core i5 3470 at 3.2 GHz on Windows 10.0.15063.138 ("Creators Update") for factoring 10100+3:

Chrome 57: 9.8 sec, Chrome Canary 60: 9.8.sec.
Firefox 52: 18.8 sec. Firefox Nightly 55.0a1: 8.3 sec.
Edge 15: 12.0 sec
Java Applet (running on Eclipse Luna): 5.6 sec.
64-bit Release version compiled from C code by Visual Studio 2015 Community: 7.1 sec.

Note the fix on performance for Firefox.

Last fiddled with by alpertron on 2017-04-17 at 02:22
alpertron is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
GHz days converting? Unregistered Information & Answers 10 2010-03-16 21:56
Converting from v4 to v5 devjonfos Linux 4 2009-01-29 10:15
Sun Tries to Get Hip to JavaScript ewmayer Programming 1 2006-10-07 21:23
JavaScript for 2-player interactive game-playing? ewmayer Programming 2 2006-02-04 19:22
Converting Logs Numbers Math 5 2005-08-14 06:29

All times are UTC. The time now is 04:08.

Wed Aug 12 04:08:12 UTC 2020 up 25 days, 23:54, 1 user, load averages: 2.00, 2.30, 2.28

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.