JDK-4968638 : extremely slow JavaScript to Java-applet calls
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 1.4.2
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2003-12-15
  • Updated: 2003-12-15
  • Resolved: 2003-12-15
Related Reports
Duplicate :  
Description
Name: gm110360			Date: 12/15/2003


A DESCRIPTION OF THE REQUEST :
JavaScript to Java-applet calls in Mozilla 1.4+JRE1.4.2 up to 10 times slower than
JScript to Java calls in IE 6.0+JRE1.4.2.

http://bugzilla.mozilla.org/show_bug.cgi?id=193282

JUSTIFICATION :
It is very difficalt to write good programs with applets using Mozilla

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Much faster calls of Java-applet functions from JavaScript.



---------- BEGIN SOURCE ----------
the test.html file

<html>
	<head>
		<script>
function testfun() {
	var applet = document.getElementById("test");	// Mozilla version
//	var applet = test;                           // IE vesrion
	var longValue = applet.getLong();
	var beginTime = new Date;
	for(var i=0; i < 10000; i++) {
		longValue--;
		applet.setLong(longValue);
		longValue = applet.getLong();
	}
	var endTime = new Date;
	alert("Processing time:\n"
	   + "begin: " + beginTime + "\n"
	   + "end:" + endTime + "\n");
}
		</script>
	</head>
	<body>
		<applet codebase="file:///C:/"		// set yours codebase
		        code="test.class"
		        mayscript
		        id="test"
		        width="200"
		        height="200">
		</applet>
		<input type=button onclick="testfun()" value="Click me">
	</body>
</html>



the test.java file

import java.awt.*;
import java.applet.*;
import java.lang.*;

final public class test extends Applet
{
	static int value = 1000*1000*1000;
	public void paint(Graphics g)
	{
		g.drawString("All right", 50, 100);
	}
	public int getLong() {
		return value;
	}
	public void setLong(int v) {
		value = v-1;
	}
}


Reproducible: Always

Steps to Reproduce:
1. Store test.html and test.java files from the details section to your local HDD.
2. Compile test.java file
3. Change applet's codebase to your location in the test.html file
4. Run test.html in Mozilla. Wait while applet is starting. Click the button.
  To start the test in IE comment the line 5 and uncomment the line 6 in the file
test.html


---------- END SOURCE ----------
(Incident Review ID: 216837) 
======================================================================

Comments
EVALUATION This is a well-known behavior. And the reason is because the current liveconnect implementation. We are try to resolve it in the script redesign 4518207. ###@###.### 2003-12-15
15-12-2003