Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4968638

extremely slow JavaScript to Java-applet calls

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.4.2
    • deploy
    • x86
    • windows_2000

      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)
      ======================================================================

            xlu Xiaobin Lu (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: