Closed Bug 193282 Opened 22 years ago Closed 19 years ago

extremely slow JavaScript to Java-applet calls

Categories

(Core Graveyard :: Java: OJI, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED EXPIRED

People

(Reporter: alexey.gaidukov, Assigned: joshua.xia)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; ru-RU; rv:1.2.1) Gecko/20021123
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; ru-RU; rv:1.2.1) Gecko/20021123

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

See the great difference in the performance!!!

Actual Results:  
JavaScript to Java-applet calls in Mozilla 1.2.1 up to 30 times slower than
JScript to Java calls in IE 6.0. JavaScript to Java-applet calls in Mozilla 1.3
beta up to 4 times slower than in Mozilla 1.2.1.

Expected Results:  
Much faster calls of Java-applet functions from JavaScript.
.
Assignee: asa → rogerl
Component: Browser-General → Live Connect
QA Contact: asa → pschwartau
---> OJI
Assignee: rogerl → joshua.xia
Component: Live Connect → OJI
QA Contact: pschwartau → petersen
Summary: extremely slow javaScript to Java-applet calls → extremely slow JavaScript to Java-applet calls
Mozilla 1.3final perform this test up to 3 times faster than 1.2.1. But it is
still much slower than IE 6.0 (near 10 times)!!!
theClass = java.lang.Class.forName("java.lang.String");
array = java.lang.reflect.Array.newInstance(theClass, 10000);
var javaString = new java.lang.String("Hello world!");

//example1
for(i = 0; i < 10000; i++) {
  array[i] = javaString;
}

//example2
for(i = 0; i < 10000; i++) {
  array[i];
}

Example1 performs up to 10 times faster than example2. Why? Is it Java plugin
bug? JRE 1.4.2_01.
I don't know a lot about JavaScript/Java, but could this be a duplicate of Bug
191035?
The first call to an applet from JS takes some seconds. Next calls are faster 
but there are much slower then the same calls from MS IE to Java. This is not 
the same bug. Calls to JRE 1.5 beta 1 is a little bit faster then calls to JRE 
1.4.2
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
Firefox:     http://www.mozilla.org/projects/firefox/
Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html
Seamonkey:   http://www.mozilla.org/projects/seamonkey/
This bug has been automatically resolved after a period of inactivity (see above
comment). If anyone thinks this is incorrect, they should feel free to reopen it.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → EXPIRED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.