mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Programming

Reply
 
Thread Tools
Old 2015-05-17, 20:57   #1
alpertron
 
alpertron's Avatar
 
Aug 2002
Buenos Aires, Argentina

23×3×5×11 Posts
Default Converting applets to Javascript

Given that the Java ship is sinking, I've started to convert the applets in my Web site to C and then I'm using Emscripten to generate the optimized Javascript.

My first applet converted to Javascript is the Ulam spiral, which can be seen at: http://www.alpertron.com.ar/ULAM.HTM

Apart from working in mobile devices, the good news is that the speed of the generated Javascript code is similar (if not better) than Java. And of course that are no annoying pop-ups and no certificates are required.

There are about 15 applets to be converted, so this task will need a few months.
alpertron is offline   Reply With Quote
Old 2015-06-11, 13:16   #2
alpertron
 
alpertron's Avatar
 
Aug 2002
Buenos Aires, Argentina

24508 Posts
Default

Using my Web server statistics, I found that only a few people is able to see Java applets. When the plugin is enabled, it downloads the JAR file which includes the Java program to be executed.

So I computed how the Java usage decreased in the last four years according to the hits of my factorization calculator.
Code:
          ECM.HTM   jar file  Java usage

Sep 2011    4183      2261        54%
Jan 2012    5156      2100        41%
May 2012    4623      1472        32%
Sep 2012    3488      1179        34%
Jan 2013    3814      1107        29%
May 2013    4456      1417        32%
Sep 2013    3008      1164        39%

Jan 2014    4114      1440        35%
Feb 2014    3569      1116        31%
Mar 2014    3632      1000        28%
Apr 2014    3623       986        27%

May 2014    3843       760        20%
Jun 2014    3107       555        18%
Jul 2014    3283       507        15%
Aug 2014    3216       610        19%
Sep 2014    3593       513        14%
Oct 2014    4263       724        17%
Nov 2014    4078       689        17%
Dec 2014    4110       685        17%

Jan 2015    4386       732        17%
Feb 2015    3842       663        17%
Mar 2015    3723       596        16%
Apr 2015    4277       639        15%
May 2015    3400       665        20%
Jun 2015    1030       186        18%
With these figures, it is clear the importance of converting Java applets to Javascript.

Last fiddled with by alpertron on 2015-06-11 at 13:37 Reason: Found data of Sep 2011
alpertron is offline   Reply With Quote
Old 2015-06-11, 13:21   #3
Stargate38
 
Stargate38's Avatar
 
"Daniel Jackson"
May 2011
14285714285714285714

2×13×23 Posts
Default

I think it's because people are using YAFU to factor their numbers. It's a lot faster.
Stargate38 is offline   Reply With Quote
Old 2015-06-11, 13:24   #4
alpertron
 
alpertron's Avatar
 
Aug 2002
Buenos Aires, Argentina

23·3·5·11 Posts
Default

That's not the problem. Notice that the HTML page is loaded but the JAR file is not in the vast majority of instances. That means that the Java plugin is not installed or the browser is blocking it (Chrome blocks the Java plugin, and most of the traffic to my Web site comes from this browser).
alpertron is offline   Reply With Quote
Old 2015-06-11, 15:27   #5
Mark Rose
 
Mark Rose's Avatar
 
"/X\(‘-‘)/X\"
Jan 2013
Ͳօɾօղէօ

AE516 Posts
Default

Lots of users block flash by default, too, like me.

The problem is that advertisers are moving to HTML5, so the web will become annoying again.
Mark Rose is offline   Reply With Quote
Old 2015-06-11, 21:30   #6
Stargate38
 
Stargate38's Avatar
 
"Daniel Jackson"
May 2011
14285714285714285714

2·13·23 Posts
Default

The Java site has instructions on how to unblock Java:

https://java.com/en/download/faq/chrome.xml#npapichrome

It worked for me.

Last fiddled with by Stargate38 on 2015-06-11 at 21:31 Reason: fix smilie
Stargate38 is offline   Reply With Quote
Old 2015-06-11, 21:44   #7
alpertron
 
alpertron's Avatar
 
Aug 2002
Buenos Aires, Argentina

132010 Posts
Default

Quote:
Originally Posted by Stargate38 View Post
The Java site has instructions on how to unblock Java:

https://java.com/en/download/faq/chrome.xml#npapichrome

It worked for me.
Yes, I know that. Unfortunately that workaround will be disabled on Chrome 45 that will be released on September.
alpertron is offline   Reply With Quote
Old 2015-06-12, 03:07   #8
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
Jun 2011
Thailand

23·29·37 Posts
Default

Quote:
Originally Posted by alpertron View Post
(Chrome blocks the Java plugin, and most of the traffic to my Web site comes from this browser).
Good and unexpected for the NSA-enabled browser!
Firefox also blocks it here (in fact it detects it as insecure and asks you to block it if you want; of course all possible insecure stuff is blocked here, by hand).
LaurV is offline   Reply With Quote
Old 2015-10-16, 11:44   #9
alpertron
 
alpertron's Avatar
 
Aug 2002
Buenos Aires, Argentina

23·3·5·11 Posts
Default

I finally had several days free to convert my sum of four squares applet from Java to C so Emscripten could convert it to optimized Javascript (asm.js). I had to develop the big number support from scratch. I still have not converted the expression analyzer. You can see it at http://www.alpertron.com.ar/newfsquares.htm (this a temporary URL that will be deleted when the expression analyzer is finished, so the current applet continues to be accessible in the meantime if you use Firefox or IE in desktops).

The most interesting bit of information here is the benchmark between Java implementation and asm.js implementation.

I found that for decomposing the 617-digit number RSA2048 in a sum of three squares, the Java applet needs 3 seconds and the Javascript application needs 11 seconds. I think the main problem is that the multiplications in Java are done in 64 bits while in Javascript are done in 32 bits, so the latter needs 4 times more multiplications than the Java implementation.
alpertron is offline   Reply With Quote
Old 2015-11-10, 22:02   #10
alpertron
 
alpertron's Avatar
 
Aug 2002
Buenos Aires, Argentina

52816 Posts
Default

Another hit for Java applets: 64-bit Firefox will not have support for them and 32-bit Firefox will drop support at the end of 2016. See https://blog.mozilla.org/futurerelea...ns-in-firefox/.
alpertron is offline   Reply With Quote
Old 2015-11-10, 23:55   #11
rogue
 
rogue's Avatar
 
"Mark"
Apr 2003
Between here and the

5,807 Posts
Default

Quote:
Originally Posted by alpertron View Post
Another hit for Java applets: 64-bit Firefox will not have support for them and 32-bit Firefox will drop support at the end of 2016. See https://blog.mozilla.org/futurerelea...ns-in-firefox/.
Now if Microsoft would stop supporting ASP in their browsers...

My company rolled out a neat features in IE a couple of weeks ago. You can go to the internal company home page with IE and click on a link to immediately see your total compensation. Isn't that cool? If I leave my computer to use the bathroom and don't lock it, then someone can walk up, click on the link and see how much I earn. Awesome! They are extending this functionality so that one can look at all benefits and personal information such as SSN, date of birth, address, etc without requiring a password. This is great because that is one less password that I have to remember.

Enough of the sarcasm.

Guess who's idea this was. HR! Guess who okayed this change. The head of IT!

Instead of taking the five minutes to remove the link from the home page, it has been available for almost two weeks.
rogue 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 09:41.

Mon Jul 13 09:41:20 UTC 2020 up 110 days, 7:14, 0 users, load averages: 1.60, 1.51, 1.50

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.