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

Startup time improvement for prism jogl

    Details

      Description

      There is still room for improvement in the start-up time of prism-jogl library. This is a continuation work of RT-8703, but this enhancement is more involve than the scope the RT-8703 plus our focus is now Windows (which uses d3d). This should be look at when Mac or other Linux based OS systems become important.

      We should look for a cheaper way to implement a cached list of available GL functions for a given context. The current implementation in GLContextImpl.setGLFunctionAvailability() is very expensive and even worst the existing start-up logic makes call to this function more than once. For the remaining ~200msec spend in prism pipe creation, about 90msec is spent in this function. Here is the timing out of a simple instrumented code:

      dhcp-rmdc-twvpn-1-vpnpool-10-159-25-210:ShapeT3DTest cyang$ javafx -jar dist/ShapeT3DTest.jar
      @@@@ GLContextImpl.setGLFunctionAvailability() ....
      (%1) GLContextImpl.setGLFunctionAvailability() process takes *** est. time = 0.055 msec ***
      (%2) GLContextImpl.setGLFunctionAvailability(): updateGLProcAddressTable() process takes *** est. time = 54.563 msec ***
      @@@@ GLContextImpl.setGLFunctionAvailability() ....
      @@@@ GLContextImpl.setGLFunctionAvailability() ....
      running on this tread
      NF.createWindow: screen: com.sun.javafx.newt.macosx.MacScreen
      Window.create: com.sun.javafx.newt.macosx.MacScreen
      @@@@ GLContextImpl.setGLFunctionAvailability() ....
      (%1) GLContextImpl.setGLFunctionAvailability() process takes *** est. time = 0.0010 msec ***
      (%2) GLContextImpl.setGLFunctionAvailability(): updateGLProcAddressTable() process takes *** est. time = 33.246 msec ***
      @@@@ GLContextImpl.setGLFunctionAvailability() ....

      Code diff:
      chien-yangs-macbook-pro-2:runtime cyang$ hg status -radm
      M prism-jogl/src/jogl/classes/com/sun/prism/opengl/impl/GLContextImpl.java
      chien-yangs-macbook-pro-2:runtime cyang$ hg diff
      diff -r 0f09d6c13340 prism-jogl/src/jogl/classes/com/sun/prism/opengl/impl/GLContextImpl.java
      --- a/prism-jogl/src/jogl/classes/com/sun/prism/opengl/impl/GLContextImpl.java Fri Aug 13 13:22:49 2010 -0700
      +++ b/prism-jogl/src/jogl/classes/com/sun/prism/opengl/impl/GLContextImpl.java Sat Aug 14 14:06:59 2010 -0700
      @@ -375,6 +375,9 @@
          * This might be usefull if you change the OpenGL implementation.
          */
         protected void setGLFunctionAvailability(boolean force) {
      + System.err.println("@@@@ GLContextImpl.setGLFunctionAvailability() ....");
      + long startTime = GLProfile.startTimer(null);
      +
           if(null!=this.gl && null!=glProcAddressTable && !force) {
               return; // already done and not forced
           }
      @@ -382,7 +385,11 @@
               setGL(createGL(getGLDrawable().getGLProfile()));
           }
       
      - updateGLProcAddressTable();
      + GLProfile.endTimer(startTime, "(%1) GLContextImpl.setGLFunctionAvailability() process takes");
      + startTime = GLProfile.startTimer(null);
      + updateGLProcAddressTable();
      + GLProfile.endTimer(startTime, "(%2) GLContextImpl.setGLFunctionAvailability(): updateGLProcAddressTable() process takes");
      +
         }
       
         /**

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ckyang Chien Yang (Inactive)
                Reporter:
                ckyang Chien Yang (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: